How to make sure your website is compatible with PHP 8

It’s been a while since PHP 8 was released, and since then PHP 8.1 has been released as an update to PHP 8. It features many improvements over PHP 7 such as feature changes, and a huge promise for performance improvements.

If you’re a developer who works with PHP, you probably already know all about the 8th iteration of PHP. After all, it was released back in November, 2020.

With PHP 7.4 nearing the end of its support period – November 26, 2022 – it stands to reason that you should upgrade to PHP 8 as soon as you can.

Additionally, since WordPress 5.6, the core platform is compatible with the newest versions of PHP. Plugins and themes, however, are much different in this regard.

Since most websites are built on WordPress, this article will focus on making sure your WordPress installation is compatible with PHP 8, and glance over the WordPress php 8 improvements.

Improvements that come with PHP 8

Similar to any major release of almost any type of software, there are big changes that come with it, as well as some minor increments and bug-fixing which makes PHP as a language much more stable and useful than the previous version.

1. Performance improvements

All major version updates to PHP usually come with an increase in performance as well, and PHP 8 is no different in this regard – in fact, it’s special, as speed was the most anticipated improvement in the new version of PHP.

The increase in performance comes from the new JIT (Just in Time) compiler that increases performance by translating the hot parts of the intermediate code to machine code.

Zeev Surasky – co-author of the JIT proposal – has created a video to show how much faster calculations can be with JIT.

Will this result in the same increase in WordPress Speed?

While the simulated test environment shows a huge improvement in terms of speed, it’s unrealistic to believe your website will load a few times faster – as the video shows – just by changing your PHP version.

Even though with PHP 8’s JIT compiler, the code could be run by the CPU itself, instead of by the Zend VM – the WordPress PHP 8 improvements (as well as other web apps) are very small, perhaps even unnoticeable.


Since web applications rely on much more than just PHP – such as database optimizations, the number of requests, and TTFB – these improvements are not likely to be big for web apps that are not specific to PHP calculations.

“It’s planned to provide additional effort, improving JIT for real-life apps, using profiling and speculative optimizations.” – notes the PHP RFC.

2. More robust error handling

Apart from Performance – which is the only user-noticeable improvement – there are also tons of other additions to PHP 8 which are mostly for developers, but affect anyone using PHP web applications such as WordPress, as themes and plugins will be easier to develop.

One of these improvements focuses on error handling.

In older versions, PHP would return a “null” when it was given a value it cannot use. However, PHP 8 gives a clearer picture and helps them better troubleshoot issues with their code.

While this does not directly affect any website owners, it will help developers debug their code and generally contribute to better quality addons for web applications.

PHP 8 and WordPress – Is your website compatible?

While WordPress has had support for PHP 8 since version 5.6, it’s much harder to get theme and plugin developers to add support for PHP 8 as it might not be needed for their specific plugin and there’s still some time till PHP 7.4 becomes deprecated.

Due to the large dependency on PHP in WordPress themes and plugins, simply changing your PHP version might cause some issues on your website and cause you to have downtime.

Obviously, the only way to be sure that a certain theme or plugin is fully ready for PHP 8 is to contact the developers and ask the question, or check if they have this information listed on their website.

However, apart from that, below, we will provide you with a robust method to check whether your website is compatible with PHP 8 before making the decision to upgrade.

Cloning your website to a staging environment

The most reliable method to check whether your website will break when upgrading to PHP 8 is to upgrade it to PHP 8 (who knew, right?). We do not recommend doing this on your production site as you can end up with some downtime.

However, most hosts nowadays include a feature to clone your website to a staging environment – and so does Eltris as well. WordPress Toolkit – a tool available in our web hosting – allows you to clone your website to a staging domain for development purposes.

To do this, while in cPanel, search for WordPress Toolkit, and under your website, choose “Clone”, then choose a subdomain to clone to, or create a new one.

Once cloning finishes, simply go into the control panel once again, and change the PHP version for that subdomain to PHP 8 or 8.1. When you open the website, you’ll see all the errors which are occurring.

For better visibility, you can also enable the “display_errors” PHP directive and ensure all errors are shown, even if they do not break your website.


This new version of PHP brings lots of new features to PHP which will help developers create better code. One of the features which is visible to the end-users as well, is the JIT compiler, which greatly speeds up the execution of PHP functions.

Since WordPress is now fully compatible with PHP 8, it is time to think about upgrading your installation, especially with PHP 7.4 nearing the end of the support period.

To ensure that your website is compatible with PHP 8, make sure to follow our advice from above to properly test your website before switching the version, as there are still plugins that do not work with PHP 8.

Your hosting can make or break your experience with running a website, Eltris provides a great platform with developer features such as cloning to staging and quick-and-easy PHP version changes.