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');
Save this as wp-config.php
12. Now in the browser address bar, install WordPress:
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..."
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]
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:
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.
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.
blog comments powered by Disqus