Webrevised

Thoughts and code on the WWW, Internet and Code culture in general

Backing up your websites can be a tedious task. FTP needs to download all files one-by-one and phpMyAdmin is not, usually, easily accessible to the webmaster. Taking the later under consideration I created a script which will let you download your website files and database content quickly and easily ……

Backing up your website is a boring, and sometimes tedious process. Nonetheless, backing up your website is really important and can save you from a lot of trouble and future headaches. Most web masters just download their websites through FTP and their database data through phpMyAdmin. This method, besides NOT being automated, is very time consuming for large websites (as lots of files are downloaded separately) and will ultimately fail when big databases have to be downloaded (because of PHP timeouts).

Considering those issues I had created a script which will compress both files and database content.

I have checked this script to work on Dreamhost, Arxive and 1and1.

Requirements

  • PHP
  • mySQL (if database backup is required)
  • PHP should be able to run command line directives through the system function
  • Output directory should have enough permissions (writeable by Apache/FTP user)

Configuration

The configuration is quite simple. Just fire up your favorite text editor and load the my_backup.php file. You just need to edit the first 3 lines:

$hardcoded_and_really_not_secure_password = "a";
$show_output = false;
$backup_directory = "backup";

The $hardcoded_and_really_not_secure_password as the name implies, contains a password for the script to operate. Nothing fancy, and probably a security threat as this is a hardcoded cleartext password .

You can toggle $show_output to have the script spit the linux commands output (usable only for debugging)
$backup_directory  is the directory the backups will be placed, relative to the script path

Installation

Upload the file to your web server. It should be accessible through your browser. That’s it!

Quick tips for a more secure installation

This script, although password protected can become a security risk. Here are some recommendations:

  • Rename the file! Give it a weird name which is hard to guess.
  • If you are using Apache server , install the script into an Apache password protected directory.
  • Set the backup path to a directory not under the wwwroot. The script output links will not work, but you can download them through FTP afterwards

Usage

It’s pretty straightforward. Fire up the script, choose if you want to backup files, database content or both and fill in database connection data. WordPress users can backup the database just by ticking the WordPress box, no need to fill in Database data. Click submit

If all went well you will be presented with the files and database download links.

That’s it, happy backups!

Download now

Download Website backup script - Dreamhost ready (141)

Categories: featured, PHP

2 Responses so far.

  1. hariram says:

    Hey i am getting the follow error

    The requested URL /website_backup/get_backup.php was not found on this server.


 
  • RSS
  • Delicious
  • Digg

Popular Posts

Hello world!

Dear visitor welcome to web revised. A blog dedicated to ...

CodeIgniter Flattr l

Download a CodeIgniter library which will enable your website to ...

To framework or not

The pre-framework era During my web development career I had to ...

Don't get hacked! Pa

We have all seen web disaster stories around us. People ...

Wordpress, changing

I have to admit it. I am in love with ...