How to Test a WordPress Backup Before Restoring
Having a website backup is a good strategy for security. A backup will help you get back your website when an irrepairable damage is done and the only option you are left with is to restore your website to a point where your it was last functional. Let us assume that as a WordPress user, you probably have a sound maintenance and backup strategy in place to protect your data from any loss or outages. But, do you have a strategy in place to test the efficiency of your stored backups? Just like any other website file, your backup could turn bad for several reasons, including:
- A backdoor or a hack
- Missing or corrupted files
- Lack of storage space
- Incomplete backups
- Virus or malware infections
- Incompatibility with an installed plugin/theme after an update.
In this blog post, we'll show you how to test your WordPress backup before restoring it.
A bad or corrupted backup file should not be used to restore a hacked WordPress website or one with a major data breach. It can lead to further complications and problems. Imagine losing all your website data and then finding out that your backup files are also not working! Clearly, an efficient backup strategy is of no use if you are unable to restore the backups when you need them the most.
You can only avoid this problem by regularly testing your website backups and ensuring that they are usable whenever you’d require them. However, testing backups is not very easy and requires you to invest your time and server resources.
Read on and I will show you a few methods to test your WordPress backups and the one that I recommend the most.
How to Test WordPress Backups Before Restoring
Here are the 3 primary ways of testing your WordPress backups:
- Manual Testing
- Backup Testing using DesktopServer
- Automated Testing using a Backup Plugin
Let’s evaluate each of these testing methods now in detail.
Method #1. Manual Testing
As a WordPress user, you can test backups manually by setting up a local testing environment on your computer.
The first step in manual backup testing is uncompressing your existing WordPress backup file. It should typically contain the following files:
- Database backup file in SQL, ZIP, or GZIP file format
- Core and customized WordPress files
Next, you need to execute the following manual steps in the given order.
To start, you need to find your database user credentials.
- Open the wp-config.php file in your uncompressed backup file. Search for the database name and user credentials (similar to how it is shown below).
- Make a note of your database name along with the user credentials (username and password) as provided in this file.
Your next step would be to create a new database.
- Log into the phpMyAdmin tool (on your local testing environment).
- Click “Create” to add a new and empty database file.
After creating the database, you need to create a database user with the same credentials as noted in the first step.
Important: Creating a database user with the same name as in the wp.config.php file is critical for your backup test to work.
- Click “Add User” in the phpMyAdmin tool to create a new database user.
- Select the right option to grant all database privileges to the newly added user.
Now you want to import the Database Backup.
- Click the newly added database file.
- From the “Format” tab, select the existing database backup file (from your local computer) that you want to import.
- Click “Go” to import the selected file.
This is a good time to upload your WordPress files to your testing environment.
- After copying your WordPress files, open the wp-config.php file, and search for the following code:
define ('DOMAIN_CURRENT_SITE', 'your-site.com');
- Replace the “your-site.com” with the “localhost” before saving the file.
After performing these steps, you can manually test your WordPress backup in your local testing environment.
Method #2. Backup Testing Using DesktopServer
As compared to manual testing, setting up a local testing environment using a tool like DesktopServer is much easier. DesktopServer allows you to create “virtual servers” where you can test WordPress backups.
- Install the DesktopServer tool on your local computer.
- After installing, upload the WordPress backup file using the “Export, import, or share a website” option in the tool.
Note that this feature is only available for premium customers of DesktopServer.
- After uploading the backup file, test the local website to see if it is functioning properly.
In summary, manual backup testing and using DesktopServer can be a long and time-consuming process. In addition to using multiple tools, you need some technical skills to test your backups smoothly without any issues.
You also need to test multiple backup versions to ensure that all of them are functioning properly and are ready to be restored at any given time. This can be a difficult task for even seasoned WordPress users.
Besides the long testing process, creating a local testing environment for each of your WordPress backups can overload your web server. This may slow down your site.
WordPress backup plugins can reduce many of your hassles, and make it easier for you to test your existing backups. Let’s see how you can use a backup plugin to test your backup files.
Method #3. Automated Testing Using a Backup Plugin
You can choose from many WordPress backup plugins that can easily set up a local environment for testing your existing backups. Among the leading backup plugins for WordPress websites, the BlogVault tool provides the following benefits that can make backup testing easier for any user:
- A complete “Auto Restore” functionality that lets you test backups and restore your WordPress website from the centralized dashboard.
- The entire backup and restore process is conducted on BlogVault’s dedicated servers, ensuring no load on the client’s web server.
- Features the “Test Restore” functionality where you can test all your stored backup versions on a “staging” website that is a copy of your live website.
- Suitable for testing and restoring backups on large-sized WordPress websites (with over 300GB of data).
- Advanced auto-recovery feature to restore tested backups on your website in a quick time.
How to use the “Test Restore” functionality to test backups:
- Create your BlogVault account.
- Add the website that needs backup. Once you do that, BlogVault automatically creates a backup of the WordPress site you specified.
- To test your backup, log in to your account and select the website that you have just added.
- Navigate to the “Backups” section of the selected website, where you can view the number of existing backups (similar to the screen shown below).
- Click the right arrow (highlighted above) to view more details of the existing backups.
- Click the “Test Restore” icon (as highlighted below) on the following page.
- Next, specify the backup version and the PHP version that you want to test.
- Click “Submit.”
- On successful creation of the “Test Restore” staging site, enter your account credentials.
- Click the “Visit Test Restore” button (as shown below).
- Once you login to your account, the tested backup version is successfully restored to your live website.
With these few easy steps, you can perform the testing of any of the available backup versions and restore them safely to your website. Once the restoration completed, you can choose to delete the “Test Restore” staging site by clicking “Delete Test Restore” from the screen (as shown above).
You can also use this tool to restore an older backup version for your website. For example, here is a sample screen showing a list of backup versions for a particular website.
Each backup version is provided with information including:
- Your WordPress version.
- The number of files and tables in your backup,
- Information about installed plugins/themes.
You can perform a “Test Restore” for any of the listed backups or select “multiple” backups to be tested.
A Quick Refresh on Why a Backup is Important
Building and promoting a website is a huge investment in terms of time and money. If something goes wrong and you don’t have a backup of your website, you will have to start again from the scratch.
Simply said, not having a backup of your website is like walking a tightrope without a safety net. In just a matter of seconds, all you have built can be gone forever leaving you with dramatic consequences.
According to a survey by CloudTweak, downtime costs an average of $26 billion a year in lost revenue and an average enterprise loses about $686.000 for every hour their website is down.
Probably your website is not even close to those massive figures but that still gives you an idea of the damage you may suffer in terms of money if something does go wrong with your website. Then take into account the impact downtime has on your visitors. If they try to visit your website and cannot access it, this will negatively affect your reputation and credibility.
Another aspect that must not be overlooked is the effect downtime has on your website’s ranking. Once your website pages are lost beyond recovery, all your money and energy spent on SEO optimization will be gone. Even if you rebuild your website, you will once again have to start from scratch to regain your previous ranking on Google and that could take months if not years.
Therefore, if something happens to your website, you need to act quickly. The only way to do that is to have a backup of your website that allows you to recover all your work in just a few minutes.
Unfortunately, the chances that your website will experience problems are extremely high. Threats are always around the corner and may come in different forms:
Website Hackers. Most often we associate hackers with people who try to access a system to steal money or access private information. However, many hackers may enter your website and crash it just for the sake of causing trouble or simply to prove how skillful they are. Once your data has been violated, there is no way to recover it unless you have a backup. Unfortunately, website hackers are mushrooming and your website may experience several attacks a day.
Malware and viruses. The Internet is full of malware and viruses and new ones are discovered on a daily basis. You may get them in countless ways, even while performing tasks that are usually considered safe. Sometimes they do not crash your website entirely but will make it act strangely affecting, therefore, user experience and performance. To clean your system files may take time and can be a daunting task. Restoring a clean backup of your website is by far the easiest and safest solution.
Hardware problems. When you deal with machines, something can always go wrong. Your hosting server can catch on fire, crash, or something else can happen. A good hosting company usually saves a backup of your files. However, never assume third parties will always take care of your business as you do. Having your own updated backup will give you better peace of mind.
Human mistakes. Deleting a file or clicking the wrong button is an accident that happens more often that you can imagine. The chances of human error increases, even more, when more people work on a website. However, this is not a major problem if you have a backup ready.
Updates go wrong. Several platforms like WordPress, regularly release updates to improve its performance and the security of your website. Unfortunately, it may happen that the fix becomes the problem and once updated your website doesn’t work correctly anymore or crashed completely. If that happens, you would be very grateful to have a backup handy.
These are just some of the most common reason why your website may experience downtime. Sooner or later you will have to come to terms with at least one of these accidents occurring, and when it does happen you must be ready to act quickly.
How Often Should You Backup Your Website
There is no straightforward answer to this question. It mainly depends on the type of website you are running.
For instance, if you only add new content a few times a month, you may backup your website less frequently. For instance, you may decide to perform a backup every time you upload some new content.
However, if you run a website where you regularly work on the content and have a lot of interaction with your users, you must make daily backups.
As a general rule, the more often you backup your website the better. As you will soon see, backing up a website is not a difficult or time-consuming task. Therefore, having a daily or weekly backup schedule is a savvy practice that will spare you a lot of pain down the road.
How To Backup Your Website
Before considering how to back up your website, we need to say a few words about where to store the backup files.
We always recommend to have the backup files stored in more than one place and to use at least one cloud service. Saving the files on your machine or on an external hard drive is a good practice but it is not risk-free. In the case of a hardware crash, you may lose all your precious files.
Therefore, besides storing the backup on a hard drive, upload the backup to at least one cloud service. That will keep your files safe and you will have access to them whenever you need.
Once decided where to store the files, you now have to decide how you want to backup your website. You have 3 main options;
1. Backup your website using cPanel. The cPanel is a user-friendly dashboard provided by many host providers. From the cPanel, you can makes changes to your websites' files and one of the preset functions is to backup of your website.
All you have to do is to navigate to the menu “Files” and click on “Backup”. You will see two options available. You can choose full-backup, commonly used when you have to transfer your website to a different hosting service, or partial backup, suitable for restoring your database on your current host.
Choose the option you prefer and click on “Generate Backup”. Once the back up is completed all you have to do is go to the section “Backups Available for Download”. Look for the file with the latest backup, download it to your machine, and don’t forget to upload a copy to the cloud.
All you have to do is install the plugin you prefer, adjust the settings according to your liking and the system will perform the backup on your behalf.
3. Manual Backup. This solution is more complicated and it requires some expertise. However, this backup gives you more control over your files.
To start the manual backup, you need to access your website files on your web server. You can do that using the file manager on cPanel. Once you are in the website files, you need to look for the root folder labeled “public_html” and download a copy of it. If your website is quite large, you must also download the database. To do that you need to install the phpMyAdmin software and perform the download from there. Once the download is completed, do not forget to upload a copy to the cloud.
As you can see, the manual backup is less straightforward than the previous ones. Therefore, unless you have the needed skills, we advise you to ask for the support of a professional website maintenance and support service.
In this article, we have highlighted the importance of testing WordPress backups before directly restoring it to your WordPress website. Testing backups can prevent most of the complications that arise due to the restoration of corrupt backup files.
Automated WordPress plugins eliminate the various hassles associated with manual or other forms of backup testing. By just clicking a few buttons, any WordPress user can easily create a staging environment for testing backups and select any of the multiple backup versions for testing.
We hope this has been helpful in helping you fix the last piece of your backup puzzle. Do let us know what you think in the comments box.