Home arrow Site Administration arrow Manage Backups for WordPress Files and Databases

Manage Backups for WordPress Files and Databases

This is the continuation of a WordPress backup tutorial that ran last month. This part will discuss two important topics: executing the wordpressmysqlbackup project in your hosting cron, and managing backups and testing the integrity of WordPress backups in your local server. The latter is particularly important.

  1. Manage Backups for WordPress Files and Databases
  2. Test Your WordPress Backups to Verify
By: Codex-M
Rating: starstarstarstarstar / 2
February 22, 2011

print this article



You can read the first part of this series here (http://www.devshed.com/c/a/Administration/How-to-Back-Up-WordPress-Files-and-Databases/).

Cron to Periodically Create WordPress Database Backups

This section assumes you've already filled the wordpressmysqbackup.php with your WordPress MySQL database access information. It also assumes that you've already uploaded the wordpressmysqlbackup folder to the define path on your web server (the one defined by $full_serverpath_to_backup).

The path of wordpressmysqlbackup is above the web root folder. The web root folder is where your WordPress files are installed, and can be accessed via web browser. Most hosting companies use  "www," "html" and "public_html" as folder names for the web root folder.

Below is a screen shot of the sample correct location of the wordpressmysqlbackup folder in the hosting server:

The next thing we need to do is let cron execute this PHP script so that the WordPress database backup will be created automatically. Cron is a hosting feature that you can use to automate the execution of tasks at specified time intervals (daily, weekly, monthly, etc).

The following is a simple procedure (using Agilityhoster.com cron tabs, which might be similar to other hosting environments):

  1. Log in to your hosting control panel.
  2. Click the "Crontab" feature.
  3. You will be asked for the command. The command is simply the full server path to the wordpressmysqlbackup.php.

Example: /home/wordpressmysqlbackup/wordpressmysqlbackup.php

It will then ask when to run the cron. If you need to run it weekly, simply set:

Minutes: 00
Hours: 00
Days: 7
Months: Every Month
Weekdays: Every Weekday

Then click "Set Cron Job". It will then generate command such as:

0 0 7 * * /home/wordpressmysqlbackup/wordpressmysqlbackup.php

It is beneficial for you to configure the cron to send you an email every time it successfully executes the script. You will know from the details in the email whether or not the backup was successfully created.

For other hosting environments, such as Go Daddy, the method for setting up the cron is entirely different from the approach outlined above.

  1. Log in to the hosting control panel and go to Cron Manager.
  2. You need to assign a Cron Job title, Frequency (weekly e.g), Day, hour and the cron command.
  3. Since you are going to place the wordpressmysqlbackup file above the HTML webroot, the cron command (for PHP version 5) is:

/web/cgi-bin/php5 "$HOME/wordpressmysqlbackup/wordpressmysqlbackup.php"

In the example above, the path to WordPress index.php (which is under the HTML folder) is: $HOME/html/index.php

Here is a screen shot (for a cron to run the WordPress database backup weekly):

>>> More Site Administration Articles          >>> More By Codex-M

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates


Dev Shed Tutorial Topics: