Database backup using PHP

In the world of web it is important to take backup of our site and database frequently. We do not know when we would come across unexpected error which causes our site stop working. Here I will show you in PHP application which will help you to take backup as per your wish whenever you want to take backup. While most web hosting company do a daily backup of a customer’s database and site, relying on them to make backups and provide them at no cost is risky also.

Never take chances when your website is on the line. Make frequent backups !

If you have any query please feel free to send a query.

PHP 5.4
MySQL 5.5
Apace http Server 2.4
Netbeans 7.4 (Optional)

Step 1. Creates a php projects using Netbeans or create a project directory under htdocs.

Step 2. Create a php file called config.php with the below source code in the project directory

Step 3. Create a common.php file with below source code in the project directory

Step 4. Create a php web page backup.php with the following source code

Step 5. Run the php file backup.php. You will get the backup sql file under the project directory.

That’s all. Thanks for reading.


Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.