PHP automatic file and database backup script
Published September 28th, 2008 in Downloads, PHPThis 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.
About
You are currently browsing the NGCoders - Next Generation Coders weblog archives.


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!