Installation failed: There has been a critical error on your website

WordPress supports installing and updating plugins and themes from the official store right through the WordPress admin interface. However, after trying to install or update a large plugin (like WooCommerce) or theme, you may encounter an error like this:

Installation failed: There has been a critical error on your website. Please check your site admin email inbox for instructions. Learn more about debugging in WordPress.

This error means that the installation process crashed, and may have left you with a broken website. To fix this, you’ll have to get rid of the broken plugin or theme and fix the installation by hand.

Identifying the broken plugin or theme

If you were trying to install or update a specific plugin, you can skip this step. But if you were running a bulk update, or an automatic update happened while you were away, you may be wondering which plugin or theme failed has broken down.

You can figure this out by enabling debug mode in WordPress:

  1. Login to an FTP client of your choice or our web based file manager (found in the client area and control panel).

  2. Navigate to your website folder (which is htdocs for your first domain and example.com/htdocs for addon domains and subdomains).

  3. Open the file wp-config.php and find the line which contains WP_DEBUG. On that line, replace false with true and save the file.

  4. Refresh the page on your website and you should now see error messages.

In these error messages, you should search for texts like wp-content/plugins/ and wp-content/themes/. The word right after that is the folder of the plugin or theme which is generating the error, which is generally the broken plugin or theme.

Don’t forget to disable WP_DEBUG after you’ve seen the error message. The option should not be left enabled for live sites, because it might expose sensitive information.

Deactivating a broken plugin

If a plugin installation has been corrupted, the first thing to do is to disable the broken plugin.

If your WordPress admin area is still working, you can deactivate the plugin from there. If that’s an option, deactivating the plugin from there is the easiest option.

If your WordPress admin area is now broken, you will have to deactivate the broken plugin by hand. You can do so as follows:

  1. Login to an FTP client of your choice or our web based file manager (found in the client area and control panel).
  2. Navigate to your WordPress plugins folder. This is typically htdocs/wp-content/plugins for your first domain, and example.com/htdocs/wp-content/plugins for addon domains and subdomains.
  3. Find the folder of the broken plugin (it should resemble the name of the plugin).
  4. Right click the folder and select “Delete”.

After this, your WordPress website and admin area should be accessible again.

Deactivating a broken theme

If a theme installation has been corrupted, the first thing to do is to switch to a different theme which does work.

If your WordPress admin area is still working, you can switch the theme from there. If that’s an option, changing the theme from there is the easiest option.

If your WordPress admin area is also unreachable, you can change the active theme by hand. You can do so as follows.

  1. Login to an FTP client of your choice or our web based file manager (found in the client area and control panel).

  2. Navigate to your WordPress themes folder. This is typically htdocs/wp-content/themes for your first domain, and example.com/htdocs/wp-content/themes for addon domains and subdomains.

  3. Check which other folders you have there. These are other themes you have on your site, which you can try. Pick one and copy the folder name somewhere. The WordPress default theme (with a name starting with twenty) is a good choice if you have it.
    image

  4. Login to the control panel of your hosting account and navigate to the phpMyAdmin section. From there, click the Connect Now button next to the database of your WordPress site.

  5. Click to the table with the name ending with _options.

  6. Find the row where the column option_name equals template. You can use the Search button at the top bar to find it.

  7. Edit the option_value column of the row you found, and change it to the theme name you found before.

Screenshot from 2022-07-17 11-46-31

After this, your WordPress theme should be changed to the other theme you selected. Assuming this theme was installed correctly, you should now be able to access your site again.

Installing the plugin or theme by hand

After you’ve removed the broken plugin or theme, you can try to install it again. You can try to do so through the WordPress admin area, but if you try this, you’ll likely end up with a broken installation again.

That’s why you can try to install the plugin or theme by hand instead.

To do so, the first step is to download the plugin or t heme zip file to your computer. If you got the plugin from a third party source, you probably already have this file. If you installed it directly from WordPress, you can find and download your plugin from the official WordPress plugin store or theme store

Next, you’ll need to upload the files to your account.

To upload the plugin or theme with FTP:

  1. Extract the zip file on your computer. It should contain a single folder with files.
  2. Setup a connection with your FTP client of choice. Learn more about how to setup an FTP connection.
  3. Navigate to your WordPress plugins or themes folder. This is typically htdocs/wp-content/plugins for your first domain, and example.com/htdocs/wp-content/plugins for addon domains and subdomains. For themes, it’s the
  4. Copy the extracted folder to the website directory. Depending on the size of the plugin or theme, this can take some time complete.
  5. After the file transfer has been completed, login to your WordPress admin area. From there, you can navigate to the Plugins or Themes interface and hit Activate on what you’ve just uploaded.

You can attempt to upload the archive through our online file manager, but this may not work depending on the size of the plugin or theme. Using a desktop FTP client like FileZilla is recommended, because it works with plugins and themes of all sizes.

6 Likes

Instead of just

define( ‘WP_DEBUG’, true );

Why not

define( ‘WP_DEBUG’, true );

define( ‘WP_DEBUG_LOG’, true );

define( ‘WP_DEBUG_DISPLAY’, false );

@ini_set( ‘display_errors’, 0 );

This way, only person(s) with the right credentials can view the debug.log in the “wp-content” directory. Error messages will also be suppressed from displaying on live sites.

Isn’t this safer?

5 Likes

Yes and no.

It’s true that error messages should not be shown to visitors. And the configuration you’re proposing indeed does ensure the debug information is not displayed on the page.

However, WordPress doesn’t protect access to the debug.log file, so anyone could download it. And because the debug output isn’t printed, it’s easy to forget to remove this code after the issue has been fixed.

Does this mode also log native PHP errors? Because if not, you’d be missing out on information that display_errors may show you.

And finally, the guide is intended to be as easy as possible. Editing a single line is easier than adding multiple new ones, I think.

7 Likes

I would believe so. This is what I can see from the debug log

[11-Jul-2022 19:18:56 UTC] PHP Deprecated: Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /home/vol9_4/

Fully agreed

4 Likes