Troubleshooting Critical Errors After a PHP Version Update in WordPress
Content
Upgrading your server's PHP version is a critical step in maintaining a secure and high-performing WordPress site. However, this necessary update is one of the most common triggers for the dreaded "There has been a critical error on this website" message. This guide will help you understand why this happens and walk you through a step-by-step process to diagnose and resolve the issue.
Why Do PHP Updates Break WordPress Sites?
Newer PHP versions (8.0 and above) deprecate or remove old functions and coding practices that were permissible in PHP 7.x. If your theme or any of your plugins use these outdated codes, they will fail when a modern PHP version is active, causing a fatal error that can crash your site or its admin area.
Step-by-Step Troubleshooting Guide
1. Enable Debugging to Find the Root Cause
The first step is to turn on WordPress debugging to reveal the specific error message. This is often the fastest way to identify the problematic plugin or theme.
- Access your site's files via FTP/SFTP or your hosting provider's file manager.
- Locate the
wp-config.phpfile in your WordPress root directory. - Edit the file and find the line that says
define('WP_DEBUG', false);. - Change it to:
define('WP_DEBUG', true); - Add this line below it:
define('WP_DEBUG_LOG', true); - Save the file and upload it back to the server.
Now, reproduce the error by visiting your site. WordPress will create a debug.log file in the /wp-content/ directory containing the specific error details.
2. The Quick Fix: The 5-Minute Plugin/Theme Test
If you cannot access your admin area (/wp-admin) after the PHP update, you can disable plugins and themes manually.
- Use FTP/SFTP to access your
/wp-content/directory. - Rename the
pluginsfolder toplugins.deactivate. - If the site loads, you've confirmed a plugin is the cause. Rename the folder back to
pluginsand then rename individual plugin folders one-by-one to identify the culprit. - If the site remains broken, the theme is likely the issue. Navigate to
/wp-content/themes/and rename your current theme's folder. WordPress will automatically fall back to a default theme like Twenty Twenty-Four.
3. Contact Your Hosting Provider
Some errors are related to the server's PHP configuration, not your WordPress site. As seen in the sample threads, two frequent server-related issues are:
- Missing PHP Extensions: Errors like "Your PHP installation appears to be missing the MySQL [mysqli] extension" or "WordPress requires the json PHP extension" mean a necessary component is not enabled on the server. Your hosting provider's support team can install and enable these for you.
- Incorrect PHP Version Reporting: In rare cases, a hidden
.htaccessfile or server configuration might be forcing an old PHP version for parts of your site. Your host can help investigate this.
4. Update or Replace Incompatible Software
Once you've identified an outdated plugin or theme, check for an update from the developer. If no update is available that supports PHP 8.0+, you must find a suitable replacement. Running obsolete software is a major security risk.
Important Order of Operations
To avoid this problem in the future, follow this order when updating:
- Update WordPress Core to the latest version.
- Update all Plugins and Themes.
- Create a full backup of your site and database.
- Then, update your PHP version on the server.
When to Ask for Help
If you have followed these steps and are still stuck, the WordPress support forums are an excellent resource. Be sure to post the exact error messages from your debug log, which will help the community provide targeted advice.
Related Support Threads Support
-
PHP Compatibility Check Reports Errorhttps://wordpress.org/support/topic/php-compatibility-check-reports-error/
-
Change to PHP 8.4https://wordpress.org/support/topic/change-to-php-8-4/
-
Old Website Problems with Software Updates.https://wordpress.org/support/topic/old-website-problems-with-software-updates/
-
PHP installation appears to be missing the MySQL extensionhttps://wordpress.org/support/topic/php-installation-appears-to-be-missing-the-mysql-extension-7/
-
composer 8 errorhttps://wordpress.org/support/topic/composer-8-error/
-
We can’t Add and edit any elements or page on my website.https://wordpress.org/support/topic/we-cant-add-and-edit-any-elements-or-page-on-my-website/
-
Updated PHP and now site doesnt workhttps://wordpress.org/support/topic/updated-php-and-now-site-doesnt-work/
-
Trying to update to PHP 8.4, now login page has errorhttps://wordpress.org/support/topic/trying-to-update-to-php-8-4-now-login-page-has-error/
-
White pagehttps://wordpress.org/support/topic/white-page-59/
-
New WordPress site gets error – WordPress 6.8 requires the json PHP extensionhttps://wordpress.org/support/topic/new-wordpress-site-gets-error-wordpress-6-8-requires-the-json-php-extension/
-
WordPress stops working after ubuntu 22.04 upgrade.https://wordpress.org/support/topic/wordpress-stops-working-after-ubuntu-22-04-upgrade/
-
PHP 7.4 to 8.0+ Critical Errorhttps://wordpress.org/support/topic/php-7-4-to-8-0-critical-error/
-
WordPress reading old PHP version, server running current versionhttps://wordpress.org/support/topic/wordpress-reading-old-php-version-server-running-current-version/
-
Updating Ubuntu Operating System Versionhttps://wordpress.org/support/topic/updating-ubuntu-operating-system-version/
-
Critical Error when trying to access my websitehttps://wordpress.org/support/topic/critical-error-when-trying-to-access-my-website/