Should You Upgrade to PHP 8 for Your WordPress Site
PHP 8 is a major update of the PHP Language that was released in November 2020. PHPBench is showing 33% better performance compared to PHP 7.1. If you are running PHP powered applications, such as WordPress, it seems like a no brainer to upgrade to PHP 8, but will you actually benefit from this upgrade?
Is WordPress Compatible With PHP 8?
According to WordPress.org, WordPress 5.9 is not fully compatible with PHP 8.0 or 8.1.
WordPress is not fully compatible with PHP 8.0 or 8.1. All remaining known PHP 8.1 issues are deprecation notices. Please note, a deprecation notice is not an error, but rather an indicator of where additional work is needed for compatibility before PHP 9 (i.e. when the notices become fatal errors).
Will Updating to PHP 8 Break WordPress Site?
PHP 8 is a major version update that has many backward compatibility issues. This is because PHP 8 deprecated many functions that older WordPress versions and plugins are using. Updating to PHP 8 will most likely break your WordPress site if any of the following is true:
- You have older version of WordPress and you do not plan to upgrade your WordPress to the newer version anytime soon.
- Your WordPress site is running plugins that have not been updated in a long time.
- You have custom PHP scripts and you do not know how to maintain them.
When Should You Upgrade to PHP 8
PHP 8 brings increased speed and optimized performance, you should upgrade if you are able to. Before updating to PHP 8, make sure you test WordPress site thoroughly to make sure everything is working as expected. The easiest way is to setup a local LNMP environment using WAMP or XAMPP, then export your WordPress site and test for compatibility issues locally.