The "critical error on this website" message is a standard WordPress error you will encounter while working with WordPress sites. Critical errors should never be ignored. Let's assess how to address them.
This article will explain the nature of the "critical error on this website" message, the root cause of the error or errors involved, and how to resolve them. In addition, a number of other valuable WordPress fixes are provided by HTTP error code or other error condition encountered.
Overview of common WordPress fixes
If you are receiving critical errors on your WordPress site, first, you must enable debugging:
Once you enable the Debug Mode, you can see the various PHP errors occurring on your WordPress site from the web browser. Using these PHP error details, you can easily find the root cause of the issue. You must also enable the Debug Log since it will save all PHP errors to a file if you can't access your WordPress Admin Panel.
Enabling Debug Mode in WordPress
You must perform the following procedures to enable Debug Mode and Debug Log.
1. Connect your WordPress site using FTP or access it via SSH.
2. Find the wp-config.php file in the document root directory. Then, open the wp-config.php file.
3. Add the following entries to the wp-config.php file and save the file to reflect the changes:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
4. You can also enable Debug Mode by simply changing the value of the WP_DEBUG line from false to true if it is already present in the wp-config.php file.
Your WordPress site is now in Debug Mode, and errors will be recorded in the Debug Log (that is, the debug.log file) in the wp-content folder. Once you've completed debugging, remember to delete these lines of code.
Here is the sample output:
[aeaf2afd@cloudhost-215052 wp-content]$ ll
-rw-rw-r-- 1 aeaf2afd aeaf2afd 139 Jun 28 12:14 debug.log
-rw------- 1 aeaf2afd aeaf2afd 28 May 16 05:20 index.php
drwx--s--x 6 aeaf2afd aeaf2afd 96 Jun 28 05:25 plugins
drwxr-xr-x 3 aeaf2afd aeaf2afd 27 May 16 05:21 settings
drwx--s--x 6 aeaf2afd aeaf2afd 104 Jun 28 05:25 themes
drwx--x--x 2 aeaf2afd aeaf2afd 6 May 29 12:13 upgrade
drwxr-xr-x 3 aeaf2afd aeaf2afd 18 May 16 05:20 uploads
You can also see detailed information about the errors from the browser. Here is the sample output:
The most common WordPress fixes for critical errors
A critical error on the WordPress site occurs typically when the PHP memory limit has exceeded the allowed limit or when there has been an error related to plugins, themes, or website code.
In addition, a data corruption issue in the WordPress database may also cause a critical error. Let's review some of the most applicable WordPress fixes for the critical errors that may occur on your site.
1. Increasing the PHP memory limit in WordPress
In WordPress, there is a limitation on how much memory can be used by any PHP script. If this memory limit has been exceeded, you will get a white screen with an error message while accessing the site. If the critical error is caused due to PHP memory Limit, you must raise the PHP memory limit to resolve this issue.
To increase the PHP memory limit, follow the steps below:
1b. Find the wp-config.php file in the document root directory and then you can open the wp-config.php file.
1c. Add the following entries to the wp-config.php file and save the file to reflect the changes:
define( 'WP_MEMORY_LIMIT', '256M' );
1d. You can increase the WP_MEMORY_LIMIT value per the error message you received.
See the Modifying the PHP memory limit on cloud hosting plans for a deeper discussion of this subject.
2. Troubleshooting plugin conflicts and related issues
If the critical error is caused due to a WordPress plugin or plugins, you will need to disable the plugin or plugins to avoid the issue:
To disable the plugin, you can follow the following steps:
2a. Connect your WordPress site using FTP or access it via SSH.
2b. Go to the wp-content/plugins folder:
[aeaf2afd@cloudhost-215052 html]$ cd wp-content/plugins
2c. Disable the plugin or plugins that caused the issue. For example, if the error is caused due to the plugin named redis-cache, you can disable the plugin by renaming it to redis-cache_bk:
[aeaf2afd@cloudhost-215052 plugins]$ mv redis-cache redis-cache_bk
2d. Once it is done, please cross-check the site. If the site is loading fine, you must investigate the plugin you deactivated with the help of the plugin vendor or website developer.
See How to clean up, remove, and manage WordPress plugins for a better understanding of plugin management.
3. Troubleshooting theme conflicts and related issues
If the critical error is caused due to the theme, you will need to change the theme to default to avoid the issue with the theme. You may quickly switch your theme to the default WordPress theme from your WordPress Admin Panel by following the steps below if you can access it:
3a. Log in to your WordPress Admin Panel.
3b. Go to Appearance > Themes.
3c. Then, click the Activate button fir the theme you want to activate:
If you can’t access your WordPress Admin Panel, you can change the theme from the phpMyAdmin tool by following the steps below:
3d. Log in to the phpMyAdmin tool.
3e. Then, click the name of your database; it will display all the tables present in it.
3f. Next, click on the wp_options table.
3g. Find template and stylesheet rows; it will have your current theme name:
3h. Double-click on both rows and change the theme name to the one already installed (for example, the twentytwenty theme). Then click on the Go button to save the changes:
3i. Once the default theme is activated, you can cross-check the site. If the site is loading fine, you must investigate the theme you deactivated with the help of the theme vendor or website developer.
4. Increasing the max upload file and text processing functions
If the critical error occurs in certain situations and it will not constantly show on every page, you can increase the value of some PHP functions to fix the issue.
For example, increasing the value of upload_max_size and post_max_size will improve the error messages you receive while uploading large files. You can also enhance the breaking of large pages on your WordPress site by increasing the recursion and backtrack limits.
4a. You may check the maximum upload file size restriction for your WordPress site from your WordPress Admin Panel by navigating to Media > Add New (if you can access that part of the user interface):
4b. To increase the max upload file and post max size, add the codes below in the wp-config.php file:
ini_set('upload_max_size' , '512M' );
4c. Add the codes below in the wp-config.php file to increase the recursion and backtrack limits:
4d. You can apply the following codes in your .user.ini or php.ini file to raise the value of these PHP functions:
upload_max_size = 512M
post_max_size = 512M
pcre.recursion_limit = 20000000
pcre.backtrack_limit = 10000000
5. Upgrading or downgrading your PHP version
Outdated PHP or incompatibility issues with the PHP versions can cause your WordPress site to break. There are chances for many incompatibilities if you downgrade or upgrade the PHP versions.
In addition, certain functions often won't work as expected due to the deprecated functions and incompatibilities — related to the PHP version. So, please get in touch with your developer and get confirmation that there won't be any issues with the PHP version you want to downgrade from or upgrade to — and confirmation that the site will work fine with the targeted version of PHP.
You can downgrade or upgrade the PHP version of your site from the Nexcess Client Portal by going to Plans > Site Dashboard > Management.
6. Restoring the site from a previous backup
If your site still has critical issues after using the above steps, restore the site from an earlier functional backup as a last option.
Other "known" WordPress issues causing critical errors
In this section, you will learn about the other frequent WordPress issues and how to troubleshoot them. Many of these issues are known in the community of WordPress enthusiasts. The resolutions are straightforward and given in the sections below.
1. Blank "White Screen"
When this error condition occurs, you will receive a blank white screen (also known as the "white screen of death") while trying to access your site or internal pages related to your site. It is caused by a plugin/theme incompatibility, PHP memory limit, or exceeded cache size.
To troubleshoot this error condition, check the site by tweaking the PHP memory limit or cache size value, disabling the plugins or themes folder, and checking if the site is loading fine. If the issue is plugin-related, you can check the site by enabling one plugin at a time. If the problem is theme related, try to change the theme to the default WordPress theme and inspect the site.
2. HTTP 500 "Internal Server Error"
Suppose the WordPress site is showing a HTTP 500 "Internal Server Error” on the screen. In that case, it could be caused due to a corrupted .htaccess file, a corrupted WordPress installation, the conflict between plugins/themes, or the PHP memory limitation.
To know if the issue is caused due to your .htaccess file, you can check the site by renaming the .htaccess file. If the site loads fine after renaming the .htaccess file, you must review your .htaccess entries or replace them with the default WordPress .htaccess file. If the site still shows one or multiple instances of a HTTP 500 "Internal Server Error", try to disable the plugins/themes folder or tweak PHP memory limit values.
3. HTTP 503 "Service Unavailable"
The HTTP 503 "Service Unavailable” occurs typically due to improper DNS configuration or server inadequacy. It could also be caused by technical difficulties from the server side.
First, you must check your server connectivity to troubleshoot this type of error. If everything works fine, you can review your DNS configuration to ensure everything is set up correctly. You can also check your web server resources if there is an issue with the web server resource usage. Sometimes, plugins or themes may cause this error. You can try disabling the plugins/themes folder to check the issue.
4. HTTP 403 "Forbidden"
The HTTP 403 "Forbidden" error commonly occurs when your site files or folders have incorrect permissions, or there is no acceptable content under the site's document root. To troubleshoot this error, you can check the files or folder permissions and missing content under your site.
5. HTTP 404 "Page Not Found Error"
If you are receiving the error HTTP 404 "Page Not Found Error” while trying to access your site or any internal pages, it might be because of using an invalid URL or caching problem, incorrect redirection, or trouble with DNS settings. It also could be because of compatibility issues with installed plugins and themes. To troubleshoot this error, try resetting your permalinks, restoring your .htaccess file, or disabling your plugins/themes folder to check the issue.
6. WordPress "Error Establishing a Database Connection"
If your site uses incorrect database credentials in the wp-config.php file, you will receive this error message while accessing your site. Review your database credentials in the wp-config.php file to troubleshoot this error.
7. WordPress "Warning: Cannot Modify Headers Already Sent"
Extra spaces usually cause this error. The extras space characters that cause is error are usually found before the <?php tag or between the <?php or ?> tags in wp-config.php file.
To troubleshoot this error, you can open the file or files mentioned in the error message and remove the extra space from the files. Also, make sure that the first line in the file is <?php and that there is no space before this line.
8. WordPress "HTTP Error When Uploading Images"
Regarding the WordPress "HTTP Error When Uploading Images" condition, incorrect uploads folder permissions, a WordPress memory limit constraint, or compatibility issues with the plugin or theme mainly cause this error. To troubleshoot this type of error, check the uploads folder permission. Also, you can prevent the problem by increasing the WordPress memory limit or disabling the plugin or theme.
WordPress fixes for critical errors summary
The "critical error on this website" message in the context of your WordPress site can be generated as a byproduct of several factors — the most common ones are PHP-related. Most likely, the problem occurred because the PHP memory limit was exceeded, or your plugins or themes were misconfigured.
Run you business on WordPress
Yes, WordPress is by far the best CMS for building an online business. At Nexcess, we’ve optimized WordPress for businesses of all sizes. Whether you’re a one-person shop or an enterprise using WordPress, our hosting scales alongside you so you can grow.
This article covered many frequent error scenarios and the applicable WordPress fixes. Contact our WordPress specialists for assistance if you cannot remedy the issue. In addition, you may also contact us if you require advice in selecting an appropriate WordPress hosting package for your site.
- Nexcess WordPress Knowledge Base
- WordPress fixes: troubleshooting WP-CLI issues
- What are the php.ini default values set for Nexcess customers?