Easy way to backup your SQL database

By: on March 09, 2016 Categories: Web Development


Here is a PHP script I made which will backup all tables in your database. You only need ftp access to upload the script, no server control panel or phpMyAdmin required.

It is an improved version of David Walsh’s code. Most important improvement: it will correctly set up foreign key restrictions.

In my set up the script will run on a certain day of the week, let’s say Monday. In case it did not run on Monday, it will still run on Tuesday (for example), creating the .sql file with the date of the previous Monday, when it was supposed to run. It will erase .sql file from 4 weeks ago, so it always keeps the last 4 backups. Here’s the code:


Da un share daca ti-a placut articolul

Share on Facebook Share Share on Twitter Share Share on Linkedin Share