The latest release of PHP was shown to give WordPress sites a 100% speed boost. If you have dedicated servers or VPS, it’s up to you to upgrade your software. If you haven’t already upgraded to the latest version of PHP, it’s time to take a look at its benefits. It’s the recommended version from WordPress, so updating PHP makes your site more stable. You must keep up with these recommendations to avoid unforeseen errors with WordPress and your plugins. Here’s how you can upgrade with as little bugs as possible.
- Back Up Your Site
Any time you update your operating system or the underlying core of your site (such as PHP), you should back up both the database and the files. Theoretically, upgrading PHP on your server should not interfere with the database, but there is still a small chance that data could get corrupted. For this reason, you should back up the site.
If you’re looking for a plugin to back up your site for you, here are a few that can help:
- All-in-One WP Migration: Copy all files, plugins and database records.
- Duplicator: This plugin acts as a backup feature and helps you move it to a new location.
- Backup Buddy: Takes a full backup of your site, but moving files requires manual interaction.
If you decide to manually back up your site, make sure you get all WordPress files, plugins, images, themes and your MySQL data.
- Set Up a Staging Server
You need a place to test your current WordPress site, and staging is the place to do it. Developers use the term “staging” server to describe a VPS or dedicated machine that is an exact replica of production. You must make sure that you have an exact replica, or your tests could be faulty. You could have false-positives and have no errors where you would have them in production.
The staging server is completely separate from a production environment and has the latest version of PHP installed, but you must have the same operating system, software installations and database setup. Don’t forget that your database should be replicated with the same data. If you have a large WordPress site, you could only move over some of the data, but the problem with this method is that you could forget data and cause errors on staging. The best way to work with a staging server set up for testing is to replicate production including all data.
- Test WordPress on Staging
After you have a staging server set up, it’s time to install all your WordPress files. If you plan to update WordPress at the same time as your PHP 7 upgrade, you can install the software from the official WordPress site. If you don’t plan to upgrade, just copy all files from your backup to the staging server.
Don’t forget to load records into a new database on your MySQL server. Some developers cheat a bit and use the production database, but this hinders your ability to test. Any changes you make on the staging server would affect your production data, so it’s better to create a separate database that you can use to test. Should you accidentally corrupt data, you can just restore from a backup.
- Upgrade to PHP 7.x
Depending on the latest version, it’s time to upgrade PHP 7.x. Currently, the most recent is 7.2.2. Install the latest version and copy your files over to your server. You’ll still want to test the site after you tested it on staging. Your goal is to find bugs before your readers do.
Note: If you find any errors in your plugins, you can either hire a developer to fix it or disable it until the original developer offers and update.