If your website runs on WordPress, encountering the “There has been a critical error on your website” error can be terrifying. Luckily, there are some quick fixes to solve the problem. This blog post examines numerous methods for troubleshooting your website and getting it up and running again.

If you are using a recent version of WordPress, there is a chance that you have encountered the error. Before WordPress 5.4, your website might have only gone blank with the white screen of death (WSoD). The “There has been a critical error on your website” can occur for various reasons.

Critical Error On Your Website

Most of the time, however, a malfunctioning plugin or incompatibilities between your themes and plugin updates are to blame for the error. Once the error occurs, you will also receive an email containing additional information. If the information is overwhelming and you don't know how to proceed, don't worry. This guide goes over the plausible causes of the error and how you should go about fixing it.


What Causes “There Has Been A Critical Error On Your Website” Error?

You ought to be accustomed to the white screen of death if you've been using WordPress for a while. The error can be brought on by several factors, including errors in your code, themes, or plugins. Other possible causes include exceeding the RAM limit and database corruption.

Since the error message does not give you much information, you might want to check the following errors first, as they might be the root of your problem.

  • ERR_CONNECTION_TIMED_OUT – Can be caused by overloading the server.
  • ERR_CACHE_MISS – Most likely caused by your website's cache or PHP tools.
  • HTTP 503 Service Unavailable – Indicates an issue with your server.

HTTP 503 Service Unavailable

  • HTTP 502 Bad Gateway – This server issue can arise if the server is overloaded.

HTTP 502 Bad Gateway

  • 500 Internal Server Error – A serious server error.
  • Error establishing a database connection – Caused by corruption in your database or an error in the database server.

Error establishing a database connection

Now that you are familiar with the possible causes of the critical error let's look into the potential solutions.


It's time to get your site up and running again. You should always back up your site before implementing any recommended suggestions. Since the site is down, you will want to access it over FTP or SFPT. It would help if you also considered installing an FTP client such as FileZilla for convenience.

1. Enable Debug In WordPress

Enabling debugging for your WordPress site will enable you to see the various PHP errors occurring on your site. You can then use the information to trace the issue to its root cause. You'll also need to activate the debug log because you might not be able to access your dashboard. After enabling debugging, the PHP errors will be logged into a file. Follow the steps below to enable debugging manually.

Step 1: Connect to your site via FTP.

Step 2: In the root folder, find wp-config.php and open it using a text editor.

Step 3: Add the following lines at the bottom of the document.

  • define(‘WP_DEBUG’, true);
  • define(‘WP_DEBUG_DISPLAY’, true);
  • define(‘WP_DEBUG_LOG’, true);

WP DEBUG LOG

Step 4: Save and Close the file.

Debugging is now enabled, and errors will be logged to a log file named debug.log in the wp-content folder. You now have information that may indicate specific themes or plugins are to blame for the problem. Make sure to remove the three lines you introduced earlier after debugging.


2. Revert To A Default Theme

Conflicting themes can occasionally be found to be the cause of the error. To test if this is the cause, you should remove your existing theme and switch to the default theme. The problem ought to be resolved if a theme clash was to blame. Prior to switching back to the default theme, you should make sure you have a backup of your website. The procedures below can be done if you have access to your dashboard.

Step 1: Navigate to Appearances, then Themes.

Step 2: Select the theme by clicking on it.

Select the theme by clicking on it

Step 3: Click Delete on the lower-right corner of the pop-up window.


3. Disable All Plugins

Simply turning off all plugins will allow you to determine whether a plugin is responsible for the issue. If doing so resolves the issue, you've identified the culprit. Follow the steps below to disable a plugin from the dashboard.

Step 1: Visit Plugins, then navigate to Installed Plugins.

Step 2: Select all plugins by ticking the checkbox at the top of the list.

Step 3: Select Bulk Actions, then click on Deactivate.

click on Deactivate

You can then turn them on again one at a time to identify the specific plugin that is causing the issue.


4. Roll Back Your Site

The problem may be resolved by restoring your website to a previous backup. Even though it doesn't always work, it's still worth a go. It is recommended that you test it on a staging site to ensure it is operational before restoring it.


5. Raise PHP Memory Limit

WordPress sets a hard limit on the amount of RAM that your website can take up. If your site exceeds the limit, you will encounter the error. While you do not want to set the memory limit too high, you will have to raise it to a value above the default. A slight increase in memory could instantly solve the problem. To increase your memory, follow the steps below.

Step 1: Open the wp-config.php file.

Step 2: Insert the following line of code just before the last line.

  • define(‘WP_MEMORY_LIMIT’, ‘128M’);

WP MEMORY LIMIT

If 128M does not solve the issue, you can try a higher value such as 256M.


6. Clear Your Site’s Cache

Clear Your Site’s Cache

Once the cache for your website has been corrupted, issues may occur. You can quickly fix the issue by clearing the cache. The cached version of your site will soon be restored.


7. Upgrade Your PHP Version

Upgrade Your PHP Version

If you are still using an old version of PHP, you should update it immediately because it could be the root of many issues. You must upgrade if you are still using an outdated version of PHP, such as version 5.x. You should also be aware that upgrading PHP can have serious consequences; as a result, you should make a backup of your website first.


8. Check For Malware

Check For Malware

Malware in the form of PHP scripts can cause breaking errors on your website. Furthermore, scanning malware can be daunting when locked out of your website. It would be, therefore, easier to seek assistance from your web host if you think malware is to blame.


9. Raise The Max Upload File Size And Text Processing Functions

If you find yourself in an error screen after uploading a large file, it is probably due to the “max upload size” being too small. To fix the issue, you will need to edit the wp-config.php file. To do so, add the following lines to the file.

  • ini_set(‘upload_max_size’, ‘256M’);
  • ini_set(‘post_max_size’, ‘256M’);

You should add the following lines to fix the breaking of large pages.

  • ini_set(‘pcre.recursion_limit’,20000000);
  • ini_set(‘pcre.backtrack_limit',10000000);

10. Reinstall WordPress

Reinstall WordPress

If non of the abovementioned solutions work, you should try reinstalling WordPress. This will solve most problems, and your site will probably work afterward. To do so, download a new copy of WordPress from the official website. After installation, select the files inside the WordPress folder and upload them to your website. You can now try visiting your site to see if the problem is solved.


Conclusion

You should now be able to fix the error. In most cases, the error can be traced back to incompatible plugins and themes. As we have seen, those cases are easy to solve. However, if the cause of the problem is more technical, such as in the case of malware, you should contact your website’s hosting company for more assistance. Moreover, you can always contact an expert if you are in doubt.