This is a pure php implementation of a php backup script. So it should work fine on windows and linux. But its not suited for takeing very large backups.
I just wrote it cause most of the script i saw offered file or database backup and broke down to usage of exec and unix commands , for which i had to contact hosting.
Some basic features -
- File and Directory backup
- Multiple database/table sql backup
- Backup email
The script is supposed to be called using automatically using CRON , and the backup folder in which backup it taken should be writable.All you have to do is run backup.php .
Edit config.php before use. Released under GNU GPL license.


Can this script be modified to push the backup to a remote ftp location automatically? Can it also be modded to incorporate an automatic schedule in it? getting its instructions from an sqlite database?
Automatic schedule would be set using cron and yes it can push using FTP , you will require php ftp library for that.
requires some additional coding after the email part.
I can’t seem to get multiple databases to work. I’ve tried comma separation, comma with a space, no comma with a space. How do I set up the config to backup numerous databases?
What I have tried:
‘database’=>’db1,db2′,
‘database’=>’db1, db2′,
‘database’=>’db1 db2′,
@Dave
It should go something like this for multiple database
$configBackupDB[] = array(‘server’=>’localhost’,'username’=>’root’,'password’=>”,’database’=>’database1′,’tables’=>array());
$configBackupDB[] = array(‘server’=>’localhost’,'username’=>’root’,'password’=>”,’database’=>’database2′,’tables’=>array());
$configBackupDB[] = array(‘server’=>’localhost’,'username’=>’root’,'password’=>”,’database’=>’database3′,’tables’=>array());
hey thanks for your great script and its will save alot of my time
I think there is something up with the zip process, it creates the zip files fine, but they cannot be opened or inflated. I get Error 1 – Operation not permitted
HAve tested zips myself they seem to work just fine.
I was trying to develop my own, but found yours.
Thanks a lot admin, its a very handy script for me!
who is the admin of site……
contect me……..
hello im having problem with this script.. im getting 2 SQL in my zip file each time i call the backup.php ? what im doing wrong?
thank alot
it seems very god
3ks for Ur script
Hi.
I put this script on my website, and after I configure it, i’m getting my db in a zip file (that’s OK), but on my email I receive “mail send … ERROR!” Do you know what could be the problem?
And one more thing: after i will resolve this issue with email sending, can you show me how to modify the script to erase from my website the zip database that was send it by email?
Thank you
Do we need to create permission to this files?
Precision Automation Robotics India Limited.
Specialize in Automation, Robotics, Welding, Gantry Robots, Robot, Machine Tending,Thermal Cutting, Forgig & Hot forming, Deburring & Polishing, Crane and Hoist Products, Stamping & Cold Forming, Standard Articulated Robot,
Portal Robots, Robot Transporters, Robotic Enclosures, Auxiliary Axis Modules (Linear & Rotary) Gauging & Measurement, Forging & Hot forming, Non Destructive Testing, Global Automation Solution provider using world class Robotic products & technologies. Leader in Automated Car Parking Solutions.
PARI- Automated Car parking System. An Ideal solution for today’s city parking and traffic problems PARI auto parking system offers utmost
Efficiency, Convenience, Safety & Reliability. Parking, Automated, Auto car parking, Machine Parking, staker parking, Two step, puzzle, tower, multiple, auto parking, car parking solution,
parking solutions, Systems, PARI, PUNE, Parking, Automation, Automatic, Solution,Robotics
Hi,
I need to keep database file in separate directory (like ‘database’ directory)instead of root directory. Can you suggest some changes existing script.
Hello, and thanks for the script.
I keep getting “Fatal error: Out of memory (allocated…” errors when running, as cron or not. I have upped the “memory_limit = 120M” limit in the php.ini, but can’t stop this error.
Any help!!!
Thanks,
This happens when , the size of database becomes quite big and pure php is not able to handle the database in a string.
Maybe next version would resolve this issue.
I keep getting the following error:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/content/g/l/o/globalwaves/html/domains/Dustinturin/scripts/backup/functions.php on line 11
Unpacked the script directly from the download, without changing anything in the functions folder… any ideas?
I had the same problem and it was resolved by switching to PHP 5 from v4.
Not that I’m totally impressed, but this is more than I expected for when I found a link on Digg telling that the info here is awesome. Thanks.
EXCELLENT SCRIPT
Just an improvement for huge backups with memory limitations.
Line 110 functions.php
$newOffset = strlen(implode(“”, $this->compressedData));
replace with:
$currentOffset = strlen( $feedArrayRow );
$newOffset = $this->oldOffset + $currentOffset;
Thanks for the script
The same at line 45.
Awesome!!! Exactly what I was looking for & it works flawlessly!! Thank you!!!
Hey thanks..
But some of my website have many pics.. It should be so big backup files..
How to make the compressed backup files got splitted in smaller size? Is that possible?
Thanks in advance
The files backup is ok but my database is empty!
It’s ok now!!!!
very helpful and nice application.
thnx to author.
THIS WoRkS lIkE cHaRm !!!!!!!!!!!!!!
I had an issue in MAC unzipping the backup files but guess what:
Stuffit Expander is THE THING!!!
No need of TERMINAL thingy to uncompress!!!
Download here:
http://my.smithmicro.com/downloads/index.html
Thank You VERY MUCH admin!!!
WOOOOHOOOOOOOO!!!!!!!
Cheers
Hello, I’m getting this errors, could you please help?
Warning: opendir(publick_html/images/) [function.opendir]: failed to open dir: No such file or directory in /home/xlote/public_html/backup/functions.php on line 465
Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘xlote_sgt2′@’localhost’ (using password: NO) in /home/xlote/public_html/backup/functions.php on line 235
Warning: fopen(publick_html/backup/backup-11-08-09 11-45-32.zip) [function.fopen]: failed to open stream: No such file or directory in /home/xlote/public_html/backup/backup.php on line 121
Warning: fwrite(): supplied argument is not a valid stream resource in /home/xlote/public_html/backup/backup.php on line 122
Warning: fclose(): supplied argument is not a valid stream resource in /home/xlote/public_html/backup/backup.php on line 123
Warning: filesize() [function.filesize]: stat failed for publick_html/backup/backup-11-08-09 11-45-32.zip in /home/xlote/public_html/backup/functions.php on line 431
Warning: fopen(publick_html/backup/backup-11-08-09 11-45-32.zip) [function.fopen]: failed to open stream: No such file or directory in /home/xlote/public_html/backup/functions.php on line 432
Warning: fread(): supplied argument is not a valid stream resource in /home/xlote/public_html/backup/functions.php on line 433
Warning: fclose(): supplied argument is not a valid stream resource in /home/xlote/public_html/backup/functions.php on line 434
mail send … OK
Any help will be appreciated, thanks!
Thanks, great script
Can I save BD in utf8?
I have a problem taht the files are backed up correctly , but when i came to open one of them for exaple a .php file using Notepad++ program , it doesn’t open correctly , i can open it only using Notepad program !!
Hi,
i had got this type of error, what to do for this.
Fatal error: Out of memory (allocated 32768000) (tried to allocate 1961911 bytes) in /zenoffice.com/backup/functions.php on line 95
Hi , thank you for you contribution!
I have a problem importing this file back to that database , when I am trying to upload it throw the phpmyadmin panel it says that the zip file has a problem and when i import the sql file from inside the zip file it runs good but all the tables contents go out with ???????? how can i make it support utf-8 encoding?
thanks.
I ran into an issue with the files being backed up. The db backup comes and the emailing works fine. But the folder with the files is coming empty.
Can you guess off-hand what might be causing that? I can’t seem to pinpoint it in the scripting, but if I can get it working completely would like to try to expand the script to gzip instead of zipping to decrease the file size.
Thanks for any answers or help.
i want to write my code but i found yours. thanks very much..
That’s funny, i love your article for beginners. I should just give up and take lessons from you
Hi there. What is the largest backup one could consider using this script ~ I have a gallery site with 20Gb+ images…
Regards
Dylan
I adore your page and will keep on coming
thanx for the script
i am planning to change my host
it will save time
Thank you!
it doesnt work for me at all. it produces a SQL file that has nothing inside it (BLANK).
i need steps for mysql5.0 database auto backup and auto restore coding in php
it’s very urgent help me
im using WAMP 5 and mysql5.0 and windows xp
Ich lese deinen Blog jetzt doch schon eine ganze weile aber irgendwie hab ich nie einen Kommentar zu deinen Artikeln geschrieben. Wollte jetzt aber endlich mal ein Lob aussprechen, sind richtig gute Artikel welche du hier jedes mal schreibst. Ich hoffe es kommen noch einige weitere interessante Artikel.
Hi, great work !!!!
How con I download directly the backup file ?
In the class I found
return $this->_DownloadFile($fname, $sql, $compress);
but that function is not defined I think ….
thx
Marco
is there some sort of automatic removal function for this as well?
its very nice, it is what i am looking for, its very simple and understandable.
Thanks
i want to know how can i take back at client side not server side after click……………