A crucial step in a great backup strategy is to test that you can restore your site from a WordPress Backup archive.
If you can’t restore your site your backup archives are worthless.
In this article
You can have the best WordPress Backup software in the world, and you can have the best backup schedule in the world.
If you do not know how to restore your WordPress site from a backup archive it will do you no good.
By testing your backup archives you:
Verify that your backup archives are healthy.
Learn the procedure for restoring your WordPress site.
If you ever need to restore your WordPress site for real you will most likely be under time pressure. Knowing the restoration procedure will save you time and give you confidence when you most need it.
These are related articles that you might also want to read (all open in new tabs):
Depending on the backup software you use your backup archive might be packaged in a different way to ours. We use BackWPup which gives us a zip file with all the files from our WordPress site plus an sql file with an extract of the database.
The name of the sql file will be different for you but the file extension will be .sql.
XAMP allows you to run WordPress on your local computer. This is a very easy way to test that you can restore your WordPress site from your backup archive. XAMP works on Windows, Mac and Linux.
To restore your backup archive on your local computer we will:
- Download and install XAMP.
- Create a new database.
- Import our data.
- Unpack the files.
- Modify wp-config.php.
- Modify the hosts file.
Follow these steps:
Click on the link for the version of XAMP that matches your Operating System. In this guide we use Windows.
Depending on your Firewall you might get a warning.
Important! Do not allow access from the Internet.
XAMPP is not secure and is only meant for testing on your local computer.
On the Windows Firewall untick Private networks and click Cancel.
Again on the firewall untick Private networks and click Cancel.
If you are asked about replacing existing files tick Do this for the next X conflicts and click Copy and Replace.
Note! If you already use XAMPP for other purposes make a backup copy before you replace any files.
Note: If you use WP Login Security 2 we recommend you disable that plugin on your local install. You can do this by removing the folder called wp-content\plugins\wp-login-security-2.
Your locally installed WordPress will not be able to send emails so this plugin will not work well.
We need to modify the database connection information.
Open the wp-config.php file in c:\xamp\htdocs.
Set DB_NAME to ‘wordpress’ (or the name you used).
Set DB_USER to ‘root’ (this is the default for XAMPP).
Set DB_PASSWORD to ” (this is the default for XAMPP).
Set DB_HOST to ‘localhost’ (this is the default for XAMPP).
Because we are setting up our site to run locally on our own computer we need a simple trick to point our domain name to our local computer. Otherwise we’ll just be accessing our live site.
To do this we need to edit a file called hosts. Think of this file as a local phone book, which tells your internet browser to make a local call instead of a long distance call when you want to talk to your WordPress site.
You can only edit this file as an administrator so you have to open the file the right way.
Click on the Windows Start menu and in the search box enter notepad.
Save the file.
Important! After you are done testing you will have to remove this line again. Otherwise you will not be able to access the online version of your WordPress site. You might want to keep the file open until you are done testing to make it easier to remove the line again.
How can you tell that your site is running locally?
Disconnect from the internet and reload your site. It should still show. If you have any resources loading from other sites (like the Facebook and Twitter counts) those will not work when you disconnect. Also when you are connected they will show the numbers from your live WordPress site.
Test your WordPress site.
See that everything works as it should, but note that if you rely on services from other internet sites (like Facebook and Twitter) they might not work quite as expected in all cases.
Please leave them below. Thanks!