Web Development

PHP 8.1 Is End-of-Life: How to Fix WordPress Errors After a PHP Upgrade

SA
Shoaib Ali · Oct 31, 2026 · 6 min read
Dark graphic reading PHP 8.1 is end-of-life, with a terminal line showing PHP 8.1.34 on the command line and PHP 8.2 on the web

If your WordPress site suddenly shows "There has been a critical error on this website" or a blank white page right after your hosting company upgraded PHP, the cause is almost always a plugin or theme that is not compatible with the new PHP version. The good news is that the problem is usually easy to find and safe to fix.

Why PHP versions suddenly matter

Every PHP version has a fixed support window. According to the official PHP website, PHP 8.1 reached end of life on 31 December 2025 and no longer receives security fixes. PHP 8.2 now receives security fixes only, and that support ends on 31 December 2026. PHP 8.3 is supported until 31 December 2027, PHP 8.4 until 31 December 2028 and PHP 8.5 until 31 December 2029.

As old versions expire, hosting companies move accounts to newer ones, sometimes automatically. Code that was written years ago for an older PHP can stop working on the new version.

What usually breaks after a PHP upgrade

  • Removed functions. Functions such as create_function() and each() were removed in PHP 8.0. Old plugins that still call them cause "Call to undefined function" fatal errors.
  • Stricter type handling. PHP 8 throws a TypeError in cases where PHP 7 only showed a warning, for example when counting a null value or doing arithmetic on a non-numeric string.
  • Dynamic properties. PHP 8.2 deprecated creating object properties that were never declared. You will see "Deprecated: Creation of dynamic property" notices, which can also break pages if they are printed before the page headers are sent.
  • Implicit nullable parameters. PHP 8.4 deprecated parameter types that are made nullable only through a default value of null, which prints deprecation messages in older plugins.

Abandoned plugins and old custom themes are the most common source of these errors.

Step 1: Get the site back online

  1. Log in to cPanel and open MultiPHP Manager. Select your domain and switch PHP back to the previous version if your host still offers it. This is only a short-term fix, because older versions no longer receive security updates.
  2. If you cannot change the version, disable all plugins. In File Manager, open the wp-content folder and rename the "plugins" folder to "plugins-off". If the site loads, a plugin is the cause. Rename the folder back, then rename individual plugin folders one at a time until the site breaks again. The last one you renamed is the culprit.

Step 2: Read the real error

Do not guess. Turn on WordPress debug logging by adding these lines to wp-config.php, above the line that says "That's all, stop editing":

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reload the broken page, then open wp-content/debug.log. The last lines show the message, the file path and the line number. A typical entry looks like this:

PHP Fatal error: Uncaught Error: Call to undefined function create_function() in /wp-content/plugins/old-plugin/main.php:42

The file path tells you which plugin or theme is responsible. cPanel can also create an error_log file in the same folder. Turn debug logging off again when you are done.

Step 3: Fix the cause

  • Update the plugin or theme. Active developers have usually already released versions that work with PHP 8.
  • If the plugin has not been updated for years, replace it with a maintained alternative. An abandoned plugin is also a security risk.
  • If it is custom code, update it: replace removed functions, declare class properties, and mark nullable types explicitly.
  • Update WordPress itself to the latest version.

Always take a full backup before you change anything.

A related problem: command line PHP is not website PHP

On cPanel servers, the PHP version used by your website (set in MultiPHP Manager) can be different from the PHP version used when you run commands in the Terminal. While reviewing our own Laravel server, running php -v in the terminal returned 8.1.34 while the website itself ran on PHP 8.2, and the project required PHP 8.2 or higher. Every artisan command printed: "Your Composer dependencies require a PHP version >= 8.2.0. You are running 8.1.34." The website was fine. Only the command line was on the older version.

The fix was to call the correct PHP binary directly, for example ea-php82 artisan, because cPanel installs a separate binary for each version (ea-php82, ea-php83 and so on). The same applies to WP-CLI and Composer. Always check both: php -v in the terminal and the version shown in MultiPHP Manager.

Step 4: Plan the upgrade properly

Because PHP 8.2 security support ends on 31 December 2026, most sites should be planned onto PHP 8.3 or 8.4. Test on a staging copy first, read the debug log for deprecation notices, and only then switch the live site. Check your site after every major plugin update.

Need help with a broken site?

If your site is down or you cannot tell which plugin is causing the error, Dydaltix provides hosting and technical support. Contact us or message us on WhatsApp.

Sources

Related reading in German: WordPress sendet keine E-Mails? Ursachen und Lösungen, a step-by-step guide to SMTP, SPF, DKIM and DMARC for WordPress sites whose contact form emails never arrive.

Share:
SA
Shoaib Ali
Founder, Dydaltix

Builds Laravel and WordPress websites and handles hosting and technical support at Dydaltix.

Related articles

Get more like this

Occasional notes on websites, hosting and PHP. No spam.