One of the reasons behind WordPress’s enduring popularity is its open-source nature. But what makes WordPress an open-source platform? Well, the answer to that would be PHP. WordPress runs on PHP, a scripting language contributing to around 79 percent of all websites!
But which version of PHP allows for the best WordPress performance? To answer this, I have benchmarked a performance test on Cloudways managed WordPress hosting, where I’ve used different PHP versions and evaluated the average response time and response count.
The Process of Benchmarking
I tested WordPress version 5.7 against different versions of PHP including 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, and 8.0. I wanted to test out WordPress in its default configuration. That’s why I used the pre-installed Twenty Twenty-One WordPress theme.
Cloudways Server Configuration:
- Cloudways Server: DigitalOcean Premium Server
- RAM: 4GB
- NVMe SSD Disk: 80GB
- Bandwidth Transfer: 3TB
- Processor: 2 Core
- Server Location: San Francisco
- MariaDB: 10.1
- Varnish Disable
The application configurations are:
- WordPress Version: 5.7
- Installed a few must-have plugins like Elementor, Bot Protection, and more.
- Twenty Twenty-One Theme
- Breeze Disable
Loader Test Settings:
- Tested Pages: 1
- Test type: Maintain Client Load
- Clients: 0 to 20
- Duration: 1 Min
The Result of Benchmarking
The graph below shows the result of the benchmarking test. The trend shows constant improvement in site performance from PHP version 5.6 to 8.0. According to this result, PHP 8.0 is the clear winner and the fastest loading time is 164 ms. PHP 5.6 is the slowest one which is almost 3 times slower compared to PHP 8.0 (the latest PHP version).
Site Performance Hierarchy (Fastest PHP Version): 8.0 > 7.4 > 7.3 >7.2 > 7.1 > 7.0 > 5.6.
– Average Response Time Graph
I also counted the total success requests for each PHP version, where PHP 8.0 has the highest success response counts with no timeout (an obvious winner). Second place is PHP 7.4, with 3032 success response counts and so on.
Success Response Count Hierarchy (Higher is better): 8.0 > 7.4 > 7.3 >7.2 > 7.1 > 7.0 > 5.6.
-Success Response Counts Graph
The result of the WordPress performance test also shows the compatibility between PHP and WordPress, and the constant improvement the former brings to your WordPress site. By looking at the results, WordPress users can easily understand the importance of the updated PHP version. For instance, if a site is currently installed on PHP 5.6 or 7.0, I highly recommend upgrading it to the latest PHP version (PHP 7.4 and above).
Also Read: How to Fix Common WordPress Errors
Try PHP 8 with WordPress for Superior Performance
No Credit Card Required
Now let’s examine each and every PHP version separately to find out the reasons behind WordPress performance in the php benchmarking tests.
This version was released on August 28, 2014, and is one of the most popular versions of PHP used by many web frameworks as well as WordPress. As of today, more than 9% of the WordPress sites are still using this version.
Despite its popularity, PHP ended active support in January 2017, but the security support was available until December 31, 2018. The majority of plugin and theme developers have also stopped supporting this version which means people using it can face serious performance issues.
The average response time is 475 ms and the total success response counts are 1311.
After 5.6, PHP did not release the 6th version. Instead, they released a major version 7.0 on December 3, 2015. It came out with some major improvements in speed, type declarations, error handling, and secured user-land CSPRNG (random data generation). It had its active support running until December 3, 2017, and security support until December 10, 2019.
More than 5.7% of the WordPress sites use this version and many plugins and themes still actively support this version. WordPress performance is satisfactory on this version.
The average response time for the same WordPress website is 234 ms and total success response counts are 2682. It’s almost twice as fast as PHP 5.6.
PHP version 7.1 was released after exactly one year of 7.0 on December 1, 2016. It had some fixes from 7.0, and a few additional features like iterable pseudotype, symmetric array, nullable types, support for keys in list(), support for negative string offsets, and void functions.
Over 4.4% of the WordPress sites use this version and had active support till December 1, 2018, and security support until December 1, 2019.
The average response time for the same WordPress website is 232 ms and total success response counts are 2699.
PHP 7.2 was released on 30 November 2017 with major updates such as security patches, better codability, deprecation of old PHP functions, and improved performance.
Currently, just 17.2% of WordPress sites are running on PHP version 7.2, and its performance, when compared to its predecessors, is better. PHP had actively supported this version till Nov 30th, 2019 while security supported until Nov 2020.
The average response time for the same WordPress website is 223 ms and total success response counts are 2812.
PHP 7.3 is another widely used PHP version. This version was released in Dec 2018. In addition to a few performance upgrades and bug fixes, 7.3 came out with the flexible heredoc and nowdoc syntax.
PHP 7.3 is being used by 29.1% of WordPress sites. WordPress’s performance on this version is much better than its predecessors. PHP actively supported this version until December 2020, and security support will be active till December 2021.
The average response time for the same WordPress website is 210 ms and total success response counts are 2979.
PHP version 7.4 is highly recommended by the official WordPress team. This version was released in Nov 2019 and over 28.7% of WordPress websites are running on it. This PHP version came out with numerous improvements and new features like arrow functions, null coalescing assignment operator, typed declarations, and more.
According to the PHP calendar, it will be actively supported till November 2021 and security support will be active till November 2022.
The average response time for the same WordPress website is 206 ms and total success response counts are 3032.
This is the latest version, which was released exactly after one year of 7.4 in November 2020. Many WordPress plugins & themes are now fully compatible, and over 1.8% of WP sites are running on PHP 8.
PHP 8 will be actively supported till November 2022 and security support till November 2023. This makes the version more reliable and secure compared to other PHP versions. For added security, you can launch your website on Cloudways secure WordPress hosting to protect it from malicious attacks.
The average response time for the same WordPress website is 164 ms and total success response counts are 3836.
Unfortunately, PHP 8.0 is being used by less than 2% of WordPress sites. WordPress’s performance on this version is much better and faster than its predecessors and besides 7.4, the official WordPress team also recommended this version for the better site experience and speed. It’s usually best to use the latest PHP version, which is why many people are still migrating their websites from PHP 7.x to 8.
Source: WordPress Version Stats
Over the years, PHP fixed its issues and launched some great features which the open-source community is gradually adopting. Being a WordPress user, you should also consider upgrading to the latest WordPress PHP version for better performance and security. The older versions will eventually deprecate, and will have limited or no support by theme and plugin developers.
Source: PHP Supported Versions
Think You’re Paying Extra Hosting Costs?
Steer clear of what you pay for your hosting needs. The Web Hosting Savings Calculator helps you instantly find out the right cloud hosting solution based on your requirements.
How to Upgrade WordPress PHP Version
After reading through this article, you may have decided to upgrade your current WordPress PHP version to the latest version for enhanced WordPress performance. Don’t worry! We have also covered how to upgrade the PHP version in WordPress.
Note: Before you proceed, please back up your WordPress site as some plugins might have compatibility issues. Next, create a staging or clone of WordPress site which uses your desired version of PHP to test out the performance of the installation. For this, you may use a hosting clone feature or XAMPP for local setup.
There are two popular ways of upgrading the PHP version.
If you are using VPS or a dedicated server then you can opt for this option. Download PuTTY to access your server using SSH. After installing, run PuTTY and access your server using its IP, username, and password. Go to your root directory and run the following command to confirm the current version of your PHP.
My PHP version is 7.3 which I need to upgrade to 7.4. To do that, I will write the following command in my SSH terminal.
apt install php7.4
Note: In order to run this command, you should be logged in as root.
Once the process is completed, run the php -v command again to confirm the latest PHP version installed on your WordPress site.
Through Hosting Platform
The Cloudways Platform offers a simple process of changing PHP versions and it’s all done just by clicking on the desired version name. Let me show you how!
First of all, take advantage of Cloudways WordPress staging environment. Make a clone or staging of your live site by going to the Application Management Panel, and hover over the quick action buttons located on the bottom right corner.
Now clone the staging of your WordPress site in another server (which you may delete after you are done testing).
Once the site is cloned, navigate to your Server Management Panel. From the dashboard, navigate to Settings and Packages and click on Packages. From the drop-down list, choose the latest version of PHP, then click on Save to initiate the process.
That’s it! It is that easy to change your PHP version using Cloudways Platform.
More than 250,000 WordPress Websites
Trust Cloudways for Speed & Reliability
We reviewed WordPress performance on various PHP versions using the benchmarking process and explained the importance of upgrading to the latest PHP versions. We also covered a couple of ways you can change PHP versions on the WordPress site. Try out PHP hosting offered by Cloudways and if you encounter any challenges or if you find performance improvements, feel free to share them with us.
Sarim Javaid is a Digital Content Producer at Cloudways. He has a habit of penning down his random thoughts and giving words and meaning to the clutter of ideas colliding inside his mind. His obsession with Google and his curious mind add to his research-based writing. Other than that, he's a music and art admirer and an overly-excited person.