Comparing WordPress from PHP 5.6 to PHP 8.0

A few days ago PHP 8.0 has come to light thus celebrating 25 years of this programming language and in a few days WordPress 5.6 will also see the light, the next version of WordPress and last of this 2020.

The initial idea in the roadmap is that WordPress 5.6 would stop supporting PHP 5.6 and support PHP 8.0, but Matt made the decision that it was still early to stop supporting that already obsolete version.

So, right now, WordPress 5.6 is going to support the following PHP versions:

  • PHP 5.6.20+
  • PHP 7.0
  • PHP 7.1
  • PHP 7.2
  • PHP 7.3
  • PHP 7.4
  • PHP 8.0

It is very likely that of all the CMS that are on the market right now, WordPress is the one that has the most wide use over PHP. Although we must not forget that WordPress, right now, for both WordPress 5.5 and WordPress 5.6 recommends the use of PHP 7.4.

Regarding the support of PHP 8 and WordPress 5.6 a few days ago the statement of what and how WordPress is going to support this version was released, which has basically focused on the correction of possible incompatibilities, but not the rewriting of the code to support new functionalities.

The million-dollar question is does WordPress work better with PHP 8.0?

And, in this unscientific study that I have done I have tried to do the same test with a WordPress in which I have applied the contents of the “visual test” (so that the main page had enough content) and that occupied a lot (as much as 80KB of main page). This would be a page with some content and that looks more like what a page can contain.

The machine has been assembled following the following installation tutorial with the corresponding settings for cache tests.

The experiment is done first with a VPS with Ubuntu 20, with the latest versions of each PHP version available, in 4 environments:

The configuration of the PHP 8.0 JIT has been done with:

opcache.jit_buffer_size = 128M
opcache.jit = tracing

All results have been obtained with the ApacheBench tool and the following command:

ab -n 1000 -c 10 https://example.com/

Time taken for tests

This figure has no value in itself, but it does give us a general idea of whether it takes more or less to do the same test in each of the configurations and versions…

The lower the value, the better.

MachinePHP 5.6PHP 7.0PHP 7.1PHP 7.2PHP 7.3PHP 7.4PHP 8.0PHP 8.0 JIT
Config 1447.389280.844328.814320.941340.995286.553206.136
Config 2168.853109.090133.471131.392122.386112.08177.171
Config 3170.710109.046132.616126.551116.518112.94678.29874.392
Config 4110.727
Config 51.302
Data is in seconds (with 3 decimal places)

Requests per second

Theoretically this is the table with the most important data, since they are the requests per second that can be made.

The higher the value, the better.

MachinePHP 5.6PHP 7.0PHP 7.1PHP 7.2PHP 7.3PHP 7.4PHP 8.0PHP 8.0 JIT
Config 12.243.563.043.122.933.494.85
Config 25.929.177.497.618.178.9212.96
Config 35.869.177.547.908.588.8512.7713.44
Config 49.03
Config 5768.29
Data is in requests per second (to 2 decimal places)

Time per request

The times it takes to make a request, on average among all requests.

The lower the value, the better.

MachinePHP 5.6PHP 7.0PHP 7.1PHP 7.2PHP 7.3PHP 7.4PHP 8.0PHP 8.0 JIT
Config 1447.389280.844328.814320.941340.995286.553206.136
Config 2168.853109.090133.471131.392122.386112.08177.171
Config 3170.710109.046132.616126.551116.518112.94678.29874.392
Config 4110.727
Config 513.016
Data is in milliseconds (to 3 decimal places)

Minimum Connection Times (ms)

Minimum connection time of all requests made.

The lower the value, the better.

MachinePHP 5.6PHP 7.0PHP 7.1PHP 7.2PHP 7.3PHP 7.4PHP 8.0PHP 8.0 JIT
Config 1882617746656711557591
Config 2465239271284288238167
Config 3474229331259267231158253
Config 4232
Config 52
Data is in milliseconds

80% Percentage of the requests served within a certain time (ms)

How many requests have been served in 80% of the time.

The lower the value, the better.

MachinePHP 5.6PHP 7.0PHP 7.1PHP 7.2PHP 7.3PHP 7.4PHP 8.0PHP 8.0 JIT
Config 14551288033523288346329252113
Config 2173411241373135812671156795
Config 3175511271368130311981164812767
Config 41156
Config 519
Data is in milliseconds

As I said at the beginning, it is not scientific data because I have tested it in a fairly simple environment, but it can give a small idea of the improvements that each of the versions suppose.

Conclusions

  • PHP 8.0 works 50% better than PHP 5.6, without a doubt
  • PHP 8.0 with and without JIT, on WordPress, is almost invaluable.
  • When WordPress gets saturated and PHP too because the machine doesn’t give more of itself (which could be considered “bad hosting”), you can lose 60% of the performance. Investing in hosting is a good idea.
  • Tuning database, cache, and other service configurations can increase performance enough to be performance-sensitive.
  • Properly configuring page cache plugins can increase speed by up to 90%.

About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.