PHP is one of the most widely used scripting languages today. More than 78 percent of all websites that use a server-side programming language use PHP. Because the entire CMS is built on PHP, it plays a critical role in the WordPress ecosystem.
Many businesses, developers, and hosts have fallen behind when it comes to supporting the latest PHP versions, which is a problem we face today. Today, we'll go over some of the reasons why everyone must use the most recent PHP versions, not only for security but also for improved performance and support.
PHP, like any other piece of software, has a release life cycle that must be followed to keep moving forward and improving.
End of life refers to the fact that these versions will no longer receive security updates and may be vulnerable to unpatched security flaws.
PHP 7.2 is no longer supported as of November 30, 2020.
PHP 7.1 is no longer supported as of December 1st, 2019.
PHP 7.0 is no longer supported as of December 3rd, 2018.
PHP 5.6 reached the end of its life cycle on December 31st, 2018. Since the first version, 5.0, was released 14 years ago, this officially marks the end of an era for PHP 5.
PHP 5.6 or lower is still used by over 35% of WordPress users. When you add this to the fact that PHP 7.0 and 7.1 are no longer supported as of December 2019, you get a whopping 64 percent of users using PHP versions that are no longer supported as of December 2019. PHP 5 is currently used by 55.8% of all PHP-enabled websites.
This is bad not only from a security standpoint but also because a large number of WordPress sites are still not taking advantage of PHP 7's additional performance improvements.
The main reason for the slow adoption of new versions is most likely due to a combination of factors:
For developers, updating their code to support newer versions of PHP takes time. This includes those who create websites, themes, and plugins, among other things.
Not only does updating code take time and effort, but it can also necessitate extensive testing to ensure compatibility.
Many WordPress hosts have been hesitant to push out updated PHP versions, fearing that it will result in more support tickets if the site breaks. Many of the support issues we see are caused by issues with older PHP versions.
However, this is no excuse to continue to use PHP versions that are out of date, unsupported, and may be slowing down your WordPress site. The good news is that there has been some progress.
Check out some of the reasons why, if you haven't already, you should consider updating.
One of the most important reasons to update PHP is to ensure that you're running on a version that's fully supported and gets security patches regularly. However, it's worth noting that some operating system vendors continue to support older versions of PHP if they included it.
Huge performance gains came with the release of PHP 7.2, 7.3, 7.4, and 8.0! It's so important that it should take precedence over a lot of the minor tweaks you might make to your WordPress site. In comparison to PHP 5.6, PHP 7 allows the system to execute twice as many requests per second with nearly half the latency. In addition, we ran our PHP benchmarks.
Benchmark for WordPress 5.0 on PHP 5.6: 91.64 requests per second
Benchmark results for WordPress 5.0 PHP 7.0: 206.71 requests per second
Benchmark results for WordPress 5.0 PHP 7.1: 210.98 requests per second
Benchmark results for WordPress 5.0 PHP 7.2: 229.18 requests per second
Benchmark results for WordPress 5.0 PHP 7.3: 253.20 requests per second
Another reason to use the most recent and supported PHP versions is for support. Many times, plugin and theme developers can only provide support for older versions of their products. This is partly due to time constraints and a lack of opportunity to test compatibility. Here's an example of a common error caused by an older PHP version and how it handles a specific function:
Parse error: syntax error, unexpected ‘’ (T_VARIABLE), expecting 3function (T_FUNCTION) in /pub/file.php on line xxx
Over 2,000 threads are returned when you search the WordPress forums for "unexpected T Function." However, due to PHP 7 compatibility issues, the same could be said for open threads. This demonstrates that the WordPress development community is still catching up with newer PHP versions.
New Features for Developers
Because there have been so many new features added between PHP 5.2 and PHP 7.4, most WordPress developers would prefer to only work on newer versions of PHP if they could. The following are some of the differences between PHP 7 and PHP 7.3:
Combined comparison operator
Null coalesce, operator
New type hinting
Iterable and void returns
Multi-catch exception handling
Keys usable in lists
More negative string offsets
Number operators and malformed numbers
HTTP/2 server push
Spread operator in array expression
Arrow functions 2.0 (short closures)
A null coalescing assignment operator
Typed properties 2.0
Covariant returns and contravariant parameters
The new custom object serialization mechanism
Check to see if your host supports the most recent PHP versions.
It took a while, but the official WordPress.org requirements now recommend a PHP 7.4 or higher host.
For sites running on PHP 5.2, Yoast SEO 4.5 will start displaying a notice in the WordPress dashboard. This notice will be large, unsightly, and unavoidable.
To find out, take a look at the options below.
Pingdom can be used to check the PHP version.
Using a tool like Pingdom or Google Chrome Devtools to see which version of PHP you're running is one of the simplest ways to find out. The version is usually displayed in the first HTTP request header. Alternatively, you can always ask your host.
Check WordPress PHP Version
If you're using WordPress 5.0 or higher, the PHP version can be found in the "Site Health" tool.
Using a File to Check PHP Version
You can also check your PHP version by transferring a file to your server via FTP.
echo 'Current PHP version: ' . phpversion();
Here are some resources to help you get up and running quickly after you've tested your site and are ready to update PHP.
Update PHP from cPanel
If your host uses cPanel, you'll most likely already have the option to change your PHP version. Simply log into cPanel and select "Select PHP Version" under the "Software" category.
After that, you can choose from the PHP versions that your host supports.
Update PHP Manually on Server
If you manage your server, we recommend consulting the official PHP installation documentation, as instructions differ depending on the operating system. Examine the changes to functions, classes, wrappers, extensions, modules, and so on.