Which PHP Version to Use for the Best Performance

PHP is a scripting language that runs over 80% of the websites on the internet, which means that if you randomly open 5 websites, 4 of them will be PHP sites and there’s a chance that the 5th one is as well. WordPress runs on the top of PHP, and you’ll need to keep your PHP updates in order to process the most requests and keep your site running quickly.

Which Version of PHP Should I Use?

Extensive testing, which you can find that people have done on different PHP versions, always shows that the latest version of PHP is the fastest. There is no reason to be running an older version of PHP, and people generally are only running an old version of PHP because they have forgotten to upgrade.

When Does PHP 8 Release?

At time of writing, according to sources, PHP 8.0 is slated to be released in Q4 of 2020 or Q1 of 2021, which means we are approaching this new PHP version. Also at this time, it’s estimated that over a quarter of websites using WordPress are still running PHP 5.6, which had support for it ended at the end of 2018. Running an unsupported version of PHP is technically fine, as 5.6 is still good, but it can really cost you in the speed of your site.

What is the Latest PHP?

Also at time of writing, PHP 7.4 has been released and is the most recent version of PHP that is available. PHP 8.0 isn’t slated for release until late 2020 or early 2021. But additionally, the 7.4 version of PHP will be supported until near the end of 2022. Again, you can still run older versions of PHP, or could still run 7x versions of PHP after 8 releases, but it can slow you down.

How Much Faster is PHP 7.4?

Consistently, if you want to handle the most amount of requests per second and therefore speed up the performance of your entire website. Studies have shown that running WordPress 5.0 with PHP 7.0 can get you less than 225 requests per second, but PHP 7.3 or 7.4 can push you over that 225 line. That speeds everything up.

Should I Update PHP?

There are a couple of different kinds of upgrades that you can perform on the PHP version that you are using. You should know that the PHP development team releases three different kinds of PHP versions that you can use. There are the main number versions, like 5, 7, and eventually 8. These are the big builds of PHP which can produce massive speed boosts when you switch over.

Then there are the second number in the sequence, which would be the 6 in 5.6 or the 4 in 7.4. This second number represents a major upgrade to PHP and allows you to speed up a little bit.

Finally, there is a third number, like the 1 in 7.4.1 or the 13 in 7.3.13. These numbers generally fix two different things. First, these third number fixes target any security issues that have popped up during the release of the PHP version. And second, these numbers usually fix some minor bugs. The bug fixes can slightly improve the speed of the PHP version, but generally not in any extensive way.

PHP.net, the site for the developers of PHP, carries announcements about these PHP versions. All users of PHP are encouraged by the site to upgrade their PHP versions when new versions pop up. This can slightly increase the speed of your site but it also claims to carry security updates with each of the versions. They put that on every release announcement on every single update, so there is no way of telling which updates include significant security fixes and which contain nothing major.

In general, you should continue to update PHP when you can.

Are There Drawbacks to Updating PHP?

Yes, there are potentially reasons why you should continue running an older version of PHP instead of updating to a newer version. You have to worry about compatibility with both the servers and host that you have, but also you have to see if your code is compatible with the latest PHP. Sometimes in newer PHP versions, certain functions and features have been changed that won’t let you use certain functions and features that your site used to rely on. It may be a bit of trial and error to see if everything works, but it is obviously better than crashing your whole site. Additionally there may be plugins which will not be supported with the latest PHP if the plugins are not updated that often.

Final Advice: Which PHP Should I Use?

Always make updates to the third number of PHP, as these are patches and fixes for any bugs or security issues that have popped up along the way of the PHP. When it comes to first or second number upgrades, proceed with slightly more caution. However, you should definitely be prioritizing PHP upgrades to make sure that your site remains competitive and fast. If there are plugins or hosts that don’t accommodate later versions of PHP, these might not be the right options for your website.