There are a number of benefits to running your WordPress website on a recent version of PHP. Among the most noticeable perks is the massive increase in speed. PHP 7.3 runs about three times as many requests per second when compared with PHP 5.6.
While performance is important, there is something even more concerning. Both PHP 5.6 and 7.0 reached their end-of-life at the end of 2018. That means neither version is receiving crucial security fixes. Therefore, the longer you remain on one of these non-supported versions, the more potential there is for something bad to happen.
The WordPress Toolbox
Unlimited Downloads: 500,000+ WordPress Themes, Plugins, Templates & Design Assets
Also of note is that WordPress is currently recommending that your web server run PHP 7.3 and is making plans to drop support for anything lower than PHP 5.6. But in this case, running at the bare minimum isn’t good enough.
So, if you’re utilizing an outdated version of PHP, it’s time to get up-to-speed. But before you upgrade, it’s important to test your site to ensure that it will continue running smoothly afterwards.
Let’s have a look at some considerations and testing methods you can leverage to get your site ready for PHP 7.x.
Considerations and Potential Roadblocks
It stands to reason that, the older your site is, the more potentially problematic running on the latest versions of PHP will be. The code that makes up the themes and plugins we use evolves over time. As such, you’ll find that some methods that were acceptable a few years ago have since become either deprecated or removed altogether.
So, before you test anything related to a PHP upgrade, it’s important that your WordPress install is fully up-to-date. That means WordPress core, along with your theme and plugins are running at their latest versions.
But what if a theme or plugin hasn’t had a new version released in a few years? That could pose a problem when upgrading your version of PHP. If these items have unsupported code, they may display errors or stop your site from even loading (the dreaded White Screen of Death).
Testing, which we’ll get to in a moment, will give you a better picture of trouble spots. But it’s worth keeping in mind that some parts of your site may need fixed or replaced.
The other major consideration is your web host’s setup. Which PHP versions do they offer? Are you able to easily switch versions in case you run into problems? Do they have plans to abandon versions 5.6 and/or 7.0? Knowing the answers to these questions will help you create the best possible plan of attack.
Whether your site is large or small, it’s important to perform some tests before you attempt to use a newer version of PHP. It requires some extra effort, but could save you from some frustrating downtime.
How you test will depend on the resources you have available and, more generally, your working knowledge of PHP. Here, we’ll focus on a couple of more basic ways to test.
Use a Staging Server
Ideally, you’ll have access to a staging environment that is running the exact version of PHP you’ll be upgrading to. This will provide you with an accurate result and a view of what’s working (and what’s not).
But even if your web host can’t provide this for you, it’s still possible to put together a local server that can approximate the experience. Software such as Bitnami, WAMP and XAMPP can get you up and running fairly quickly.
Either way, having access to a cloned version of your site makes the testing process much easier. With debugging turned on, you can thoroughly check the front and back ends for any show-stopping issues.
Run a Compatibility Check
While not always 100% accurate, you can also use a compatibility checking tool to see how your WordPress install holds up on a specific version of PHP.
The free PHP Compatibility Checker plugin will search through your site’s theme and plugin code in an attempt to uncover some common issues. You can select the major version of PHP you want to test against (7.1 or 7.2, for example) and the plugin will do the rest. An itemized report is generated that will show any potential problems that have been found.
Finding and Fixing Errors
If your site is displaying errors, you’ll need to invest some time in finding their source and then repairing them. Sometimes, the errors themselves will lead you right to the culprit. For example, one that mentions the path of a specific plugin would be a pretty good indicator of where you should look for solutions. But it’s not always that easy.
If the error is a bit more vague, you’ll need to put on your detective’s hat and do some troubleshooting. The standard procedure in WordPress is to deactivate all plugins and switch to a default theme, such as Twenty Nineteen. This is another reason why you’ll want to use a staging environment if at all possible.
With all of your plugins deactivated and the default theme in place, load up the site on the front end. Notice any errors? Odds are that they will have been eliminated, since you’re running a completely stock install of WordPress.
Next, it’s time to start activating plugins and testing them, one-by-one. Turn on a plugin, and click around on the front end. No errors? Repeat the process until you’ve found the troublemaker. If none of your plugins are triggering an error, then move on to your theme.
Once you know which item(s) are problematic, you can look for solutions. In the case of a third-party plugin or theme, you’ll want to start with the support forums and see if you can find others who have had the same issue. Perhaps there’s a solution. Or, you can at least report the problem to the author.
If that doesn’t lead to a fix, some decisions have to be made. Software that has known compatibility issues that aren’t being fixed means that you’ll probably have to move on to something else. Hopefully, you can find a suitable alternative that you can test and implement.
Note that, while you can theoretically patch third-party software on your own, it’s a temporary band-aid at best. A future update could overwrite your work and lead to a broken site.
If the offending code is something you’ve written, dig through the PHP documentation and see how you can bring it up-to-standard. While it may be tedious, this is still better than having to rely on someone else to fix their product.
Better Speed and Security
After you’ve cleaned up any issues on your site and are running PHP 7.x, you can sit back and enjoy the benefits. Your site will process requests much faster, thus improving the user experience.
Even better is that you’ll have some piece of mind in knowing that, whenever any security holes are found in PHP, they’ll be patched. Then there is the satisfaction of knowing that your WordPress website is running on code that is compatible with the latest standards.
Upgrading PHP isn’t necessarily the must enjoyable or fun experience. In fact, it can be quite frustrating when trying to track down and fix errors. But the end result makes it truly worth the effort.
- The WordPress header.php Template File: Do’s and Don’ts of Good Header Design
- Unraveling the Secrets of WordPress’ comments.php
- How to Remove PHP out of WordPress Template Files and Placing it in Dynamic Pages and Posts
- A Beginner’s Guide to Using WooCommerce
- How to Speed up Google Fonts in WordPress
- 8 Essential Free Plugins for WordPress Multisite
- How to Add SSL to Your WordPress Website
- How to Display Content Based on WordPress User Roles