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.
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):
Log in to your hosting control panel.
Click the "Crontab" feature.
You will be asked for the command. The command is simply the full server path to the 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.
Log in to the hosting control panel and go to Cron Manager.
You need to assign a Cron Job title, Frequency (weekly e.g), Day, hour and the cron command.
Since you are going to place the wordpressmysqlbackup file above the HTML webroot, the cron command (for PHP version 5) is: