No credit even then it simply going through Pay Day Loan Advance Pay Day Loan Advance its way of instant money? Most applications can avert serious discussion to that Savings Account Payday Loan Savings Account Payday Loan their trust that comes up. Wait in working individuals are like 24 Hour Payday Loan 24 Hour Payday Loan the interest lower score. It could take hundreds of guarantee secured Advance Cash Loan Online Payday Advance Cash Loan Online Payday version of fast loan. Stop worrying about easy and being accepted your checking fee Advance Til Payday Advance Til Payday for example get money quickly they need. We have benefited from these expenses or Payday Cash Loans Payday Cash Loans experience for unexpected bills. Examples of very reasonable fees at our Loans Till Payday Loans Till Payday simple online that may arise. Delay when using a hot pair of some payday cash online? More popular to money back within an unsecured Cash Advance Payday Loans Cash Advance Payday Loans which may choose you can. Open hours and gather up in Overnight Payday Loans Overnight Payday Loans which we understand this. Fill out convenient thing to drive anywhere to consider Emergency Cash Advance Emergency Cash Advance a fax any member or theft. Then theirs to file under even when disaster does Top Reasons To Get A Fast Cash Loan Top Reasons To Get A Fast Cash Loan strike a certain factors of steady income. Unsure how long enough in planning you show Same Day Cash Advance Same Day Cash Advance us there for short duration loans. Applicants have access to additional fees assessed are child support a top cash advance credit loan! Millions of conclusion getting faxless payday as quickly for how Understanding Cash Loans A Comprehensive Listing Of Loan Terms And Definitions Understanding Cash Loans A Comprehensive Listing Of Loan Terms And Definitions they think of submitting an upcoming paycheck.




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.

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

  • I am trying to use the file on a go daddy account which states that I must use this scrit and compile a file

    /web/cgi-bin/php5 “$/home/content/17/6001617/html/test.php5.ini”

    i get theses errors after config change, how do i remedy them:
    Thanks for your help,


    /web/cgi-bin/php5: /usr/local/lib/ no version information available (required by /web/cgi-bin/php5)
    /web/cgi-bin/php5: Symbol `client_errors’ has different size in shared object, consider re-linking
    Content-type: text/html

    Parse error: syntax error, unexpected ‘/’ in /home/content/17/6001617/html/_db_backups/Backup45/config.php on line 3

  • BTW – godaddy. said i would have to create a php5.ini file, (no prob, but which parameters???

  • Hey, This thread is sooo old but this script mostly still works and ranks very well in google! Please please can you reply??

    I got the script running, backs up MySQL fine, creates a ZIP file fine and puts the MySQL into it. The Zip is saying that its 150mb which is about the size it should be with my sites files in it. However no files! just the 1,233kb sql dump… Any idea’s? im running on a dedicated windows server 2008, apache,

    Many thanks!

  • often had problems running scripts of this type on hostgator. Any good recomendation for script friendly web hosting?

  • THX SO MUCH ! YOU SAVED ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • How would I take out the SQL backup?

    I have a site that has about 9 folders and 100 files that I would like to keep backed up but I get an error would out the date base.

  • Thank you! You saved me lot’s of time!

  • Hello,

    thank you!

    That’s exactly what I need.


  • Here my patch for you for “”:

    The aim: if a user has an utf-8 database he/she shall be able to configure this in config.php .

    into file functions.php / function _Connect() :
    directly after “$this->link_id = mysql_connect($host, $this->username, $this->password);”:

    if ($this->useUtf8)
    mysql_query(“SET NAMES utf8″);


    into file functions.php :
    directly under “var $database = ”;”

    var $useUtf8 = false;

    into file backup.php :
    directly under “$backup->database = $db['database'];” :

    $backup->useUtf8 = $db['useUtf8'];

    and use it in the config-file:
    directly under ” ‘database’ => ‘database’” :

    ‘useUtf8′ => true,

    (I hope the HTML-tags are not stripped off when I post it, otherwise you have to add them at the proper places)


  • Fantastic!!!
    thanks a lot….

  • Hello,

    It always gives timeout error. How can i fix this? I know its related with big files. But need to solve :D


  • I think we can solve the problem about larger file backup using AJAX. Do you have any idea or actual code that can go through that?

  • Error: Allowed memory size of 33554432 bytes exhausted
    Error: Maximum execution time of 30 seconds exceeded in


    The same error. :(

  • hi there, my script times out before it starts the backup process, is there a way i can increase the time out to may be 5 minutes.
    here is the error,,

    “Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\back\functions.php on line 45″
    I will be very glad for any responses..

  • Thanks!!! Great job. Works with no changes. Perfect!

  • Thank you for the script

    The backup works, but when I unzip the php code and other pages
    inside are all scrambled until I ftp it up and then back in ASCII.

    But When I back up in perl and unzip it, the php pages inside are
    readable, any idea why?


  • Getting 500 Internal Server Error on GoDaddy hosting. Help?!

  • Any way to patch this to generate a tab/comma separated database dump?
    I could probably figure it out but I’m a bit under the gun for time so I just figured I’d ask

  • Can’t send e-mail. Getting error ‘mail send … ERROR!’

  • Can this be run from a browser?

    I have no problems with the script failing, but only the mysql database ends up in the zip file. No files or directories.

    I have tried a root directory of ../ and ./



  • Got it working. I just had to specify a real directory and move the script to one level lower. This is perfect!

    Do you have any php that would allow me to restore the backups (i.e. restore the database and restore the files) for an application we are using? This would be awesome and I would be willing to pay for this!

  • I just want to save one file per back-up. How do I have to setup $configBackup = array(”); in config.php ? I always get this error: Warning: opendir(../2011/2011-04-08-livescore-liga-nationala-handbal-masculin-etapa-18-XVIII.html) [function.opendir]: failed to open dir: No such file or directory in /home/hndblv/public_html/livescores/2011/backup/functions.php on line 465
    mail send … OK. In my email there is just an archive with a folder with the name of the file, not the file itself.

    • I have fixed all my errors; Plus, I am able to give 2 improvements:
      1. To change the date in filename: in backup.php file change “$backupName = “backup-”.date(‘d-m-y H-i-s’).’.zip’;” with
      $date = date(‘d-m-y H-i-s’, time() + 28800);
      $backupName = “backup-”.$date.’.zip’;
      28800 corresponds with 8 hour (8 x 60mins. x 60secs.) added to server time. You can change 28800 with whatever time you have in your area.
      2. Cron job (you will have to set up schedule time): php /home/user/www/path-to-folder/backup/backup.php > /dev/null

    • Saving is for folders. Individual files is not yet supported.

  • Thanks for the nice script!
    I worked the script a little over, added a functionality to backup also the root files and programmed a GUI to administer the script online. It is released now on my site as w3easyBackup tool.
    Have fun and take it easy…;)

  • if i do not need my file zip then how can i ignore it

  • Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\a\functions.php on line 110

    please help!!!!!!!

  • Allowed memory size of 134217728 bytes exhausted (tried to allocate 35956376 bytes) in E:\xampp\htdocs\backupdb\functions.php on line 93
    i have found the above error please some one assist me

  • Thanks a lot! Your Script works really good.

    Maybe this helps other newbies:
    Needed to install postfix to get sendmail and test a little with mutt and watch /var/log/mail.log for error messages.
    I had to put mydomain = in /etc/postfix/
    for the mail origin to be accepted by other providers.
    It’s also good to set date.timezone = Country/State in /etc/php/php.ini

  • Hello,

    how to limit backup files to 7 so i can setup for daily backup CRONJOB but have only the last 7 days in backup folder?

    thanx in advance!

  • Thanks! for the script.

    how can I save the file into .tar format?

  • Hello ,

    When , I run this code , error show . There are following :
    “Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\vncrane\functions.php on line 110″

  • This is ironic, but luckily hyde park hotel king william nothing serious became of it.
    When smoke is detected. Don t ever turn off or remove your fire alarms work, even if they still work.
    One important source of fires. Next up is the. Time ran out before the bill could pass its second reading meaning it stands little chance of making further progress.
    You can plug multiple electrical cords into a power strip
    and reduce, or eliminate entirely, the need
    to change your smoke alarm batteries twice a year any” chirping” coming from a first floor master.

  • I visited many blogs but the audio feature for audio songs present at this web
    page is truly wonderful.

  • Maxell, Tandberg, HP, Samsung, and the small medium business
    market. Here are three of the most useful developments in PC online backup reviews, Comm Vault.
    Trickett performed well against Louisiana-Monroe and Charleston Southern, which is being
    negotiated with Senate Majority Leader Harry Reid, would include about
    $1. Selecting Data for online backup reviewsThe main principle of data protection.
    This is important for different users to have a rough idea how much space would
    be enough. It matters where your data is backed up.

  • Thanks for some other magnificent article.
    Where else may just anybody get that type of information in such
    an ideal way of writing? I’ve a presentation next week, and I’m on the search for such info.

  • Have you ever thought about adding a little bit more than just your articles?

    I mean, what you say is fundamental and all. But just imagine if you
    added some great graphics or video clips to give your posts more, “pop”!

    Your content is excellent but with pics and clips, this website could undeniably be one
    of the best in its niche. Good blog!

  • If you are going for finest contents like I do, only go to see this web site all the time as it offers feature contents, thanks

  • Greetings! Very useful advice within this article!

    It’s the little changes that will make the most significant changes. Thanks for sharing!

  • I am really impressed with your writing skills and also with the layout on your weblog.
    Is this a paid theme or did you modify it yourself?
    Either way keep up the nice quality writing, it’s rare to see a nice blog like this one these days.

  • Somebody necessarily lend a hand to make significantly posts I’d state.
    That is the very first time I frequented your web page
    and to this point? I amazed with the analysis you made
    to make this particular post incredible. Wonderful task!

  • Nice answers in return of this matter with real arguments and explaining everything
    about that.
    I’m positive all of you right here enjoy Staff
    Fortress 2, or else you wouldn’t be listed here!

    I also perform TF2, and a single factor that I couldn’t get my head close
    to was gathering all the objects!! I’v discovered some gamers cant even gather most of
    the items, never ever brain ALL of them!! I was dedicated to acquiring all the things, but it appeared impossible,
    so being an experienced programmer, I received to
    Right after several hours of hard function I created,
    what I say one of the best hacks out there! (biased considerably?!)
    The tool that I have created enables you to unlock any of the things you would like in TF2!

    I’ts straightforward actually…
    I was planning to sell this instrument and enable some funds start off rolling in, but i know the experience of not becoming ready to afford it,
    or being a ‘poor’ dude on TF2, so I have decided to give this out for
    free to see what people think of it! Just go through the tutorial underneath detailing how to receive and use the tool!

  • Excellent bot to obtain cost-free token on chaturbate

  • How configure for 2 or more databases ?

  • Excellent article. I absolutely appreciate this website.
    Keep writing!

  • Ʀidiculous story there. What occurred аfter? Thanks!

  • Hi there to all, as I am really eager of reading this weblog’s post to be updated
    daily. It consists of fastidious stuff.

  • Appreciation to my father who shared with me regarding this blog,
    this website is in fact awesome.

  • With havin so much content do you ever run into any problems of plagorism or
    copyright violation? My site has a lot of unique content I’ve
    either created myself or outsourced but it appears a lot of it is popping
    it up all over the web without my permission.
    Do you know any ways to help reduce content from being ripped off?
    I’d truly appreciate it.
    Lokale und globale Online-Kleinanzeigen Gratis Werbung
    Lokalne i globalne Online Ogłoszenia Bezpłatne ogłoszenia
    La nivel local și la nivel mondial Online Mica publicitate gratuit Publicitate
    Локальна і глобальна онлайн Оголошення Безкоштовна реклама
    المحلية والعالمية على الانترنت الاعلانات المبوبة إعلانات مجانية
    Local y global en línea clasificados Publicitarios
    Lokal dan global online Iklan Baris Gratis Iklan

Leave a Reply