Spacer
Spacer

NGCODERS.COM

[ NEXT GENERATION CODERS ]

Spacer


PHP automatic file and database backup script

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.


8 Responses to “PHP automatic file and database backup script”  

  1. 1 Jason

    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?

  2. 2 admin

    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.

  3. 3 Dave

    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′,

  4. 4 admin

    @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());

  5. 5 land

    hey thanks for your great script and its will save alot of my time ;)

  6. 6 Josh

    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

  7. 7 admin

    HAve tested zips myself they seem to work just fine.

  8. 8 Burhan

    I was trying to develop my own, but found yours.

    Thanks a lot admin, its a very handy script for me!

Leave a Reply



About

You are currently browsing the NGCoders - Next Generation Coders weblog archives.

Categories

Subscribe