php8-wp-compatibility.jpeg

PHP 8 WordPress compatibility

On November 26, PHP 8 was released to the world. PHP’s latest version offers new features and improvements promising to greatly enhance the security and performance of our WordPress sites.

WordPress Core is compatible with PHP 8.0 since its 5.6 release. 

But should I upgrade right away?

Let’s analyze the main changes and WordPress compatibility

What performance changes are coming with PHP 8?

The most exciting performance feature coming to PHP 8 is JIT, “Just In Time” compilation. PHP is an interpreted language, meaning that it is translated into machine code as it runs. JIT keeps track of code that’s frequently used and attempts to optimize the machine code translation so that it can be reused. This can result in a massive performance improvement for specific functionality. 

The RFC proposal describes JIT as follows:

“PHP JIT is implemented as an almost independent part of OPcache. It may be enabled/disabled at PHP compile-time and run-time. When enabled, the native code of PHP files is stored in an additional region of the OPcache shared memory and op_array→opcodes[].handler(s) keep pointers to the entry points of JIT-ed code.”

https://wiki.php.net/rfc/jit

The PHP8 compilation tests show that JIT would make CPU-intensive workloads run significantly faster. However, remember WordPress’s main bottleneck is its database. The major part of the waiting time does not come from the PHP execution, but from the MySQL process time, which cannot be solved with the help of the JIT compiler. 

Is WordPress compatible with PHP 8?

PHP 8.0 is a major version update with a large number of changes that break backward compatibility and many features that were deprecated within the PHP 7.x feature releases have been officially removed. 

One of the most important breaking changes in PHP 8 has to do with strict typing. Many built-in functions are now pickier about the input they accept, and PHP 8 itself is more stringent about how input is passed to functions. Issues that previously resulted in notices now result in warnings, and issues that previously resulted in warnings now result in errors.

Another important compatibility problem can be, Warnings converted to error exceptions. There are a large number of PHP warnings that have been changed to error exceptions in PHP 8.

The WordPress core team has been working since release 5.6 in all these code deprecations. But, taking into consideration that WordPress is never used in isolation, (we always install third-party themes and plugins), being able to run our WordPress base install on PHP 8 does not indicate “full” compatibility.

Is my WordPress setup compatible with PHP 8?

Wait. The state of PHP 8 support within the broader ecosystem (plugins, themes, etc.) is impossible to know. For that reason, our recommendation is to check your setup in a staging environment.

Testing my WordPress with PHP 8

If you do not have PHP8 with your current provider, or your hosting does not have a Staging environment (a copy of your site where you can test and experiment), Signup! in 10 seconds, we provide you with FREE development servers.

At wetopi, with your Free or paid Plan, you can change back and forth your PHP Engine from v5.6 to v8.0.

Testing my WordPress site in a wetopi staging server

  1. Login to your Wetopi and go to your site page.
  2. Open the “Menú options” of your production server and click the Clone option:

    wetopi clone menu option
  3. In your new staging server: open the Menu options and the Advanced options section. There you can Switch on the PHP 8 with a single click:

    Switch from php7 to php8

Our recommendation:

PHP 8.0 is the latest version of PHP yet. This version introduces the JIT engine that, in short, developers will embrace, providing more efficiency and future performance. We also have to take in mind that PHP 7.4 is going to reach its end of life in November of 2022 and will no longer see security updates.

Being said that, our recommendation is:

— Start by testing the compatibility of your WordPress theme and plugins in a sandboxed or test environment —. and upgrade your live site if no issues arise.

At wetopi, we want to minimize the friction that every professional face when working and hosting WordPress projects.

In short, we are just techies passionate about WordPress. With wetopi, a specialized WordPress hosting, we want to go further to offer professionals and agencies a platform to work efficiently and effectively.

Not a wetopi user?

Try now – you’ll find an efficient way to work with WordPress

Free full performance servers for your development and test.
No credit card required.

Joan VegaPHP 8 WordPress compatibility
Share this post