Enter

Development / 10 min read

What to Do if Updating to PHP 8.1 Crashes Your WordPress Site?

colorful PHP code on a dark blue screen

PHP is the programming language in which WordPress is primarily written. It runs on the web server that hosts your site, and regularly updating it improves your site’s performance and security. But what happens when updating to PHP 8.1 crashes your WordPress site?

When that happens, the most common cause of the problem is that a plugin or theme is incompatible with the new PHP version, leading to a critical error that takes down your site.

Our article will review this and other common causes of PHP incompatibilities and the strategies you can use to successfully update your PHP version without crashing your site.

Key Takeaways

  • The most common reason why updating your PHP version crashes your site is that one of your plugins or themes is incompatible with the newest version.
  • To solve the problem, you should first revert the PHP update.
  • After reverting the update, you should try updating all themes and plugins and your WordPress version, then try again. Other strategies include checking for plugin and theme incompatibilities individually and using debug mode to spot the source of the problem.

WordPress and PHP Compatibility

WordPress makes an effort to support the newest PHP versions as soon as possible.

More specifically, WordPress tries to support a new version as soon as said version reaches feature freeze, which happens when the PHP development team doesn’t plan to add or remove any more features from it.

However, only some PHP versions have full support. As of the time of writing, WordPress technically supports the most recent PHP versions, but only supports 8.0, 8.1, and 8.2 “with exceptions,” and 8.3 is currently on beta support. For up-to-date information, check WordPress’s official PHP compatibility table.

This conditional support means that updating to versions 8.0 and higher may cause incompatibilities, and you may encounter issues.

Why Would Your WordPress Site Suffer Crashes After Updating to PHP 8.1?

Due to the possible incompatibilities mentioned above, your site may crash after updating to PHP 8.1.

However, in our experience as WordPress developers, the WordPress core usually runs well with the newest PHP versions, so the most likely reason for the crash is a plugin or theme incompatibility. Plugin incompatibilities are more common.

For example, your WordPress plugin or theme may rely on a deprecated PHP function that PHP 8.1 may no longer support. Deprecated functions may work for some time, but they will likely be deleted from the PHP core in the future, possibly leading to fatal errors and similar problems.

If your plugins or themes haven’t been updated to be compatible with 8.1, they can cause the site to break.

Another possible reason why updating to 8.1 crashed your WordPress site is that your hosting environment doesn’t support this version since not all server stacks support the newest PHP version(s).

What to Do When Your Site Crashes After Updating to PHP 8.1?

If you updated to PHP 8.1 and your WordPress site crashed, you’re likely seeing a fatal error screen such as this one:

WordPress error message reading "There has been a critical error on this website"

When this happens, you can’t access your admin to manage your site, so your first goal should be to revert the update. Here’s the step-by-step process.

How to Revert the PHP Update on Your WordPress Site

To revert the PHP update, repeat the process you performed to update it, but select an earlier version of PHP than 8.1.

As you likely know, to update PHP, you need to log in to your hosting account and access a hosting control panel like cPanel. Some providers use alternatives to cPanel, but the process is very similar.

If you’re using cPanel, the easiest way to access it is by adding /cpanel to your domain name. Simply go to your live site and type the following in the address bar.

https://your-domain-name.com/cpanel

Like this:

A URL in a browser's address bar

You’ll land on the cPanel login screen. Fill in your username and password and press Log In.

cPanel's login screen

After logging in, you will see many sections, but you’re looking for the one titled MultiPHP Manager.

cPanel's main interface, displaying multiple settings and options for managing a site's hosting configurations

On the search bar at the top, type php and select MultiPHP Manager from the results.

cPanel's main interface, displaying multiple settings and options for managing a site's hosting configurations

On the next screen, you will see information about your site’s current PHP version. Currently, your site should have version 8.1 installed.

cPanel's main interface, displaying multiple settings and options for managing a site's hosting configurations

You will also see a dropdown menu on the right with a list of PHP versions you can install. 

First, click the checkbox to the left of your site’s name to select it and then, on the dropdown menu, select the PHP version your site was running before the update, which was likely 7.3 or 7.4.

cPanel's main interface, displaying multiple settings and options for managing a site's hosting configurations

After that, go back to your live site and refresh it.

cPanel's main interface, displaying multiple settings and options for managing a site's hosting configurations

It should be working again if you selected the last PHP version your site ran successfully.

5 Methods to Fix Your Site After Updating to WordPress 8.1

Now that your site is back online, it’s time to correct whatever problem caused it to crash during the PHP upgrade.

As mentioned earlier, the most common cause is an outdated plugin or theme, as WordPress itself is very active in providing support for the latest PHP versions as soon as possible.

Let’s review the most common strategies for fixing potential issues and preparing your site to update the PHP version successfully.

Method #1: Update WordPress, Plugins, and Themes

Note: Take a moment to back up your site before updating WordPress, plugins and themes. Additionally, we recommend making another backup after everything is updated.

You may have attempted to update PHP without first updating all the major elements of your WordPress environment: your WordPress version, plugins, and themes.

To ensure that your PHP update has the highest chance of success, you should first update all these elements. Updates introduce security patches for known vulnerabilities and provide new features, stability, PHP compatibility improvements, and performance enhancements.

To update your WordPress version, go to Dashboard > Updates and click on the Install version X.X.X button.

The WordPress admin interface. An arrow points to the button to update your WordPress version.

To update your plugins, scroll down to the Plugins and Themes sections.

Click Update Plugins to update all plugins.

The WordPress admin interface. An arrow points to the button to update all plugins.

Finally, click on Update Themes to update all themes.

The WordPress admin interface. An arrow points to the button to update all themes.

Again, we recommend you make a backup after everything is updated and before proceeding. 

With everything updated, go back to your hosting account, open cPanel or whichever control panel your hosting provider uses, access the MultiPHP Manager tool, and try to update to version 8.1 again.

Now, go back to your live site and refresh the page. Hopefully, your site will work normally again.

Method #2: Check for Plugin Incompatibilities

If updating to PHP 8.1 crashes your site even after updating plugins, themes, and WordPress itself, the next common culprit is plugins. Revert the PHP update as explained above and keep reading.

It’s common for plugin incompatibilities to cause issues that prevent your site from working as intended, so it’s a good idea to check those first.

The best strategy here is to disable and re-enable each plugin individually to see which one is causing the error.

Go to Plugins > Installed Plugins. Click on the empty white box at the top to select all plugins.

The checkbox that allows you to select all plugins in the WordPress admin

Now go to the Bulk actions menu and select Deactivate.

The "Deactivate" option in WordPress's Bulk Actions menu

At this point, all plugins will be deactivated.

To test compatibility, start activating each plugin one by one. After activating a plugin, return to your site and see if it goes back to normal. If one of the plugins is incompatible with PHP 8.1, at some point, you’ll activate a plugin that will restore the error.

Once identified, you may explore the plugin’s settings to see if you can configure it to solve the issue, check whether you’ve added any custom code that may not be compatible, contact the plugin developer to ask about it or switch to a similar plugin that doesn’t break your site.

The most common issue with incompatible plugins is that they are outdated and no longer work as intended. We recommend going to the plugin’s page on WordPress.org and checking the last time it was updated and the PHP versions it was tested on.

A WordPress plugin's page in WordPress.org. A notice at the top warns about the plugin being outdated

If it hasn’t been tested on the last major releases, it may be a sign that you need to look for an alternative.

Method #3: Switch to a Default Theme

Sometimes, themes can be incompatible with PHP versions, too. These incompatibilities can be hard to spot, but the best way to test whether your theme conflicts with your PHP version is to switch to a default theme.

On the dashboard, go to Appearance > Themes and activate one of WordPress’s default themes, such as Twenty Twenty-Four, Twenty Twenty-Three, or Twenty Twenty-Two.

WordPress's available themes in the "Appearance > Themes" menu

If your site returns to normal after switching to a default theme, there’s probably something wrong with the theme you’re using. You may need to contact the developer for support.

Method #4: Activate and Use WordPress Debugging

Note: WordPress recommends that you use debug features only in staging or local environments and not on your live site.

WordPress has built-in debug features that allow you to create logs of errors and warnings. You can review these logs when your site crashes and they will point you to where the error is.

The logs don’t provide solutions, but once you’ve identified the problem, you can research the solution via the WordPress.org forums, Google searches, or the theme or plugin developers.

To enable debug logs, add the following code to your wp-config.php file. You must add the code before the /* That's all, stop editing! Happy blogging. */ line for it to work.

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

This code snippet enables debug mode and logging but also prevents errors and warnings from displaying on your pages to avoid interfering with page generation.

The debug log is stored in a file named debug.log within the WordPress core’s wp-content directory. The path to the debug.log file is public_html > wp-content > debug.log.

Go to the wp-content folder in public_html using cPanel or an FTP client like FileZilla. Inside, you should be able to see the debug.log file.

The FileZilla interface. An arrow points to a file that logs debug information for a WordPress site

The file contains all the debugging information your site generates.

The contents of the WordPress debug.log file

Use the debug information to pinpoint the problem (such as a fatal error) and fix it or ask your hosting provider about it.

Method #5: Contact Your Hosting Provider

If you’ve tried several solutions and can’t seem to figure out what’s wrong or how to solve it, it may help to contact your hosting provider. They may have experience with this issue and take the appropriate steps to solve it.

Contacting them and explaining the problem may get them to scan your site and look for potential solutions.

Recover Your Site After Crashing Due to a PHP Update

PHP updates make your site faster and more efficient. However, some users experience crashes on their WordPress site after updating to PHP 8.1. These crashes happen mostly if one of your plugins or themes is not compatible with it.

In this article, we explored the most common reasons why sites crash after updating PHP and explored 5 strategies to help you identify and solve them. Hopefully, you can use this information to resolve the problem and bring your site back to normal in no time.

If you found this post useful, read our blog and resources for more insights and guides!