How to Update the PHP Version
on Your WordPress Site
PHP is the most popular server-side programming language, and it’s used for all WordPress sites, plugins, and themes. Basically, without PHP, WordPress wouldn’t exist.
In the next few months, all WordPress sites will need to update to the latest version of PHP in order to avoid major security & performance issues on their website.
Think of this PHP update to when you get a recall notice for your car. You could choose to ignore it and not take the steps to get the recalled part fixed, but down the line, you could have major problems. The same is true of your website if you decide to skip this.
WordPress and PHP
The unique thing about PHP is that it is a server-side language. This means that when we talk about PHP versions and updating a website to a new version, you have to consider the hosting server.
Similar to the WordPress core and plugins, there are new versions/updates of PHP released every few months (see chart below).
Each version of PHP is fully supported for 2 years, which means during that time, any bugs and security issues are fixed and patched. After 3 years from the release of that version, there is no longer any security support for that version.
After December 31, 2018, PHP 5.6 will no longer receive security or support, which means the code will no longer be secure. Starting with WordPress 5.2, any sites on PHP versions below 5.6 will not be able to update to the latest WordPress core.
Unfortunately, the majority of WordPress sites are using PHP 5.6 or a lower/outdated version.
PHP 7.3 was released in 2018 and will receive security support until 2021. It’s recommended to upgrade to your WordPress site to PHP 7.3 or 7.4 as soon as possible. As of 2021, most sites are transitioning now to 7.4.
3 Critical Reasons to Update to a Supported PHP
You get the notice that a part is being recalled and you need to go to a mechanic and get it replaced. You could choose to ignore the recall, but there is a big risk that you’ll have problems in the future.
On your car you may have the best tires and top of the line fuel, but if that recalled part stays in your car, none of those features will matter and you could still have car problems.
Your WordPress website and this PHP update are very similar. Because PHP is a programming language used on the server level, even if you’ve done everything you can to optimize & secure your website, any issues with PHP will affect the entire website for all your visitors.
1. Prevent Security Breaches
If you aren’t using a supported and secure version of PHP, then your website could be at risk of being hacked. Because of the popularity of WordPress, it is one of the top platforms targeted by hackers. There is a major concern in the WordPress community that if a potential security vulnerability occurs in PHP 5.6, it will remain unpatched and could be exploited by hackers.
2. Performance Improvements
There are also a lot of benefits once you upgrade to the latest supported PHP version. PHP 7.4 offer potential performance improvements for page speed, in addition to greater memory efficiency on the server side.
3. You May Not Have a Choice
The majority of big hosting platforms like WP Engine are requiring websites to upgrade to the latest PHP by a certain date due to security reasons.
If a hosting platform doesn’t require the PHP upgrade, they will at least no longer offer support if an issue occurs due to an outdated version of PHP on the website. With this in mind, check with your hosting provider to determine if there is a deadline to get your website ready.
How to Check & Update the PHP Version on WordPress
Updating to the next PHP version requires a lot of testing on your website and collaboration between a website development team and the hosting server.
Make sure to follow these steps before upgrading your website, or you could run into major issues on the site.
1. Check the Current PHP Version of Your Website
The majority of WordPress websites are using PHP 5.6 or even earlier versions.
If you aren’t sure what version of PHP your website and hosting are running on, first check with your hosting provider. The PHP version is typically only shown in the hosting platform. You may see a warning about PHP in your WordPress dashboard if your site is running on an extremely outdated version. Starting with WordPress 5.2 update, all sites will need to be on at least PHP 5.6 in order to update to the latest WordPress core.
You can also ask your web development team to help you find this information in your hosting platform, or by installing a plugin like WP-Optimize to see information on your websites’ PHP version.
2. Test the Website with a PHP Compatibility Checker
If your website is not currently running on PHP 7.4, you’ll first need to run compatibility tests on your website.
Why do you need to test first? The first reason is that there are several features in PHP 5.6 that have been removed from the latest PHP versions.
The second reason for the testing is that WordPress plugins and themes also run on PHP and there are a lot of plugins and themes that are still using outdated PHP versions.
If you skip the compatibility tests, you could have major issues or things on your website break once you update the PHP version.
To run the compatibility tests, install the Compatibility Checker plugin.
It’s best to have a WordPress developer install and run this test so that you don’t cause any issues on your live site. Make sure to test the website for 7.4 version. If you recall, the 7.0 PHP version will soon be ending its full security support.
The compatibility checker will show any plugins or theme files on your website that are not compatible.
Note on False Positives with Compatibility Checkers
It is possible to get false positives with the compatibility checker. It’s common for plugins or themes that are backwards compatible with older versions of PHP to be flagged with the testing tool.
An experienced PHP developer should manually check each plugin to see if the plugin isn’t compatible with PHP 7.4.
3. Fix Compatibility Issues on Your Website
If you run the compatibility scan on your website and there are no issues flagged, then you can safely proceed to step 4 and the PHP upgrade.
If the compatibility scan shows any plugins or themes that will not work with PHP 7.4, then you will need to work with a WordPress web developer or development team to fix these issues.
For any plugin that is flagged, your developer can determine whether you can replace the plugin with an alternative option that is PHP 7 compatible. For some websites, it may be difficult to replace certain plugins. In that scenario, your development team can try to patch the plugin code to make it compatible.
4. Upgrade the PHP Version to 7.4
Once you’ve completed all the testing and compatibility fixes on the website, you can safely upgrade to the latest version of PHP.
You’ll need to notify your hosting provider that you’d like to upgrade to PHP 7.4 server. This update needs to occur on the hosting platform.
The majority of hosting platforms for WordPress sites like WP Engine are requiring websites to upgrade and moving sites to a PHP 7.4 server by a certain date. You may see different articles about upgrading to “PHP 7.” Remember that PHP 7.0 version will be ending its active support in 2018 and will not be supported past 2019, so PHP 7.4 is your best option.
After the upgrade, check your website and make sure everything is working well. You’ll also need to make sure only PHP 7.4 plugins are installed going forward on your website by your development team, or you could have future breakage & issues.
Staying on Top of PHP Version Updates
Even though there won’t be another “recall” for a while after you upgrade to PHP 7.4, every WordPress site needs regular maintenance & security to keep it running smoothly.
If you go too long without a tune-up or oil change on your car, eventually your car will break down. The same is true of your website. Get help from an experienced PHP WordPress development team to perform monthly updates on your website, security updates and install a daily database backup system.
With preventative maintenance and staying on top of “recalls,” you can keep your WordPress site running in tip top shape.