Home arrow Site Administration arrow Page 2 - Manage Backups for WordPress Files and Databases

Test Your WordPress Backups to Verify Integrity - Administration

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.

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Suppose you already have a backup copy of both your WordPress database and personal files. Your next job is to assemble them together in a local server environment. Why?

The major reason is to test the integrity of your backups. A common mistake in doing backups is failing to test them to see if they work. Below are the important steps you'll need to undertake to test WordPress backups.

1. Install XAMPP on your computer. XAMPP is a local Apache server that can run PHP and MySQL. It is  available for common operating systems, such as Linux and Windows.

If you are using Windows, you need to download XAMPP here: http://www.apachefriends.org/en/xampp-windows.html

Scroll down to the "Download" section and download the "EXE" version of XAMPP Windows 1.7.3 (Basic Package). This was the latest version at the time this tutorial was written. The installer is around 51 MB.

The installation is straightforward. If you are using a TrueCrypt container (this was discussed in the first part of this tutorial), create a separate container for XAMPP and install XAMPP to this container. For example, suppose you have a TrueCrypt virtual drive L: . XAMPP should be installed at the root of the virtual drive. So the installation path will be L:XAMPP.

The benefit of installing XAMPP in an encrypted container is added security for any passwords present in the scripts and database. They are not stored in clear text.

To learn some tips and techniques on the use of XAMPP in Windows, you can read this tutorial: http://www.aspfree.com/c/a/BrainDump/XAMPP-Tips-for-Running-an-ApacheMySQL-Server-in-Windows-XP/1/

If you are using Ubuntu/Linux, you can read this XAMPP installation tutorial: http://www.devshed.com/c/a/Administration/How-to-Install-XAMPP-on-Ubuntu-Linux/

Do not proceed to the next step if your XAMPP is not fully installed or not running properly. Try running a few basic PHP scripts to see if the test server runs properly.

2. Download the latest version of WordPress here: http://wordpress.org/download/. This should be the same version as the one you are using on your live site. If not, you should update your website to use the latest version of WordPress for security reasons.

3. Unzip the WordPress package. It will extract a folder named "wordpress," whose contents include the core files of WordPress:

4. Change the name of the folder from wordpress to the domain name of your website (e.g. yourdomain). Make it one word only.

5. Copy this renamed folder (containing the WordPress core files) to XAMPP htdocs.

6. In the first part, you backed up the following important and personal WordPress files: .htaccess, the wp-content directory, robots.txt and the other website files and directories that you created, except for the core WordPress files.

Let's start integrating your wp-content directory with the wp-content folder contained in the core files. First, delete the wp-content core directory. Now replace it with your backup wp-content directory (the one containing your own WordPress theme files, plugins, uploads, etc).

Now copy and paste robots.txt, as well as your other non-WordPress files, into your local wordpress site root directory: /htdocs/yourdomain/, the same relative path used in your live site.

Do not yet include your .htaccess file.

7. Create a MySQL database for your local wordpress installation. Go to this URL: http://localhost/phpmyadmin/

8. Enter your MySQL root credentials (username: root and password: yourpassword).

9. Under  the"MySQL localhost" - "Create new database" text box, enter the name you plan to use for your MySQL database. Use the same WordPress database name you use in your live hosting account. Then click the "Create" button.

10. Log out of phpMyAdmin.

11. Go back to /htdocs/yourdomain/ and open wp-config-sample.php. Enter your local MySQL database credentials.

define('DB_NAME', 'Your wordpress database name');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'Your XAMPP MySQL root password');
/** MySQL hostname */
define('DB_HOST', 'localhost');

Save this as wp-config.php

12. Now in the browser address bar, install WordPress:

http://localhost/yourdomain/wp-admin/install.php

Input the site title, test password (not your actual password), your email, check "Allow my site..." then click "Install WordPress."

13. If you can see "Success," go back to http://localhost/phpmyadmin/ and then click the WordPress database until you see its tables:

14. You need to import your actual WordPress website's MySQL database (the one you have backed up using the wordpressmysqlbackup PHP script).

The following are the detailed steps:

a. Click the "SQL" link.

b. You need to empty all WordPress database tables. Copy and paste the query below into the text box field in "Run SQL query..."

TRUNCATE wp_commentmeta;
TRUNCATE wp_comments;
TRUNCATE wp_links;
TRUNCATE wp_options;
TRUNCATE wp_postmeta;
TRUNCATE wp_posts;
TRUNCATE wp_terms;
TRUNCATE wp_term_relationships;
TRUNCATE wp_term_taxonomy;
TRUNCATE wp_usermeta;
TRUNCATE wp_users;

Click "Go."

c. Click "Import" and then click "Browse." Browse to the location in your hard drive where you have saved your WordPress MySQL backup. After locating the file, click "Open."

d. Finally, click "Go." This will import the your WordPress database into the XAMPP MySQL database.

15. Copy your actual WordPress .htaccess to your website root directory into XAMPP /htdocs/yourdomain/

Open the .htaccess. Revise this line from:

RewriteRule . /index.php [L]

TO:

RewriteRule . /yourdomain/index.php [L]

16. Now go to the wp_options table in your WordPress database using your XAMPP phpMyAdmin. Assign a new option_value for the following option_name:

a.)
Option name: siteurl

FROM:
Option_value: http://www.yourdomain.com
TO:
Option_value: http://localhost/yourdomain

b.)
Option_name: home

 

FROM:
Option_value: http://www.yourdomain.com
TO:
Option_value: http://localhost/yourdomain

17. Finally test your website backups if it is fully working, enter this URL in your browser: http://localhost/yourdomain

Try visiting your WordPress website pages to see if everything works the same as it does in your live site. 

WordPress Backup Management Tips

Now you have a fully running backup of your website in your local server. Here are some final tips.

  1. Any time you download a more updated version of your WordPress database backup (every week, for example, from the cron), load it up to your local server using phpMyAdmin and the techniques illustrated earlier.

  2. Any time you update the live site's WordPress files, download only those files that you have changed (you need to do this weekly or monthly as an example). There is no need to download everything again. You can trace which files are modified by looking at the "Last Modified" column using your SSH client, such as Filezilla, in the live site's hosting server.

  3. NEVER edit the WordPress core files. If you do, all of your customized changes will be lost during a WordPress upgrade, and can make your backup system (discussed in this tutorial) not so useful. Instead of editing core files, look for a WordPress plug-in which can give your site the functionality you seek.

This is a more efficient approach to doing WordPress backups. In case a disaster happens to the live site, you can confidently restore your website, because you have a fully working backup version.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- 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: