fbpx

There Has Been a Critical Error On This Website: 9 Quick Fixes

Posted on May 28th, 2022
by Asma Khalid

For WordPress site owners, the notice "there has been a critical error on this website" is unsettling. It prevents users from accessing the website, and in some situations, it prevents access to the admin panel altogether.

Fortunately, it is feasible to resolve this problem quickly. This article will explain what the notice "There has been a critical problem on your website" means and how to fix it.

What is "there has been a critical error on your website" error?

Some WordPress issues will prevent you from accessing the dashboard, displaying the notice “There has been a critical error on this website. Please check your site admin email inbox for instructions.”

This notification indicates that the site has a fatal PHP error. When a PHP script stops running and is therefore unable to fulfill its task, this error occurs.

WordPress includes a feature that recognizes when a plugin or theme creates a fatal error and notifies the admin email address in order to assist its users. Users will learn more about what is causing issues in the email.

A URL to view the site in recovery mode is also included in the email. To safely log into the WordPress dashboard and resolve the problem, follow the link.

Check your spam folder if you get this WordPress error but don't receive an email message. However, it is possible that site owners will not receive the email and would be forced to investigate the problem on their own.

What causes this critical error?

If you've been using WordPress for a while, you've probably heard about, and possibly even experienced, the White Screen of Death. Your entire website, and occasionally even your backend, would load as a blank white page as a result of this surprising bug.

This blank screen has been changed with a critical error and the words "There has been a critical error on your website." in newer versions of WordPress. Please look for instructions in your site administrator's email inbox."

Similar to the White Screen of Death, the problem is usually caused by a PHP problem: either your memory limit has been exceeded, or a mistake in your code, plugins, or theme. It could potentially be a problem with database corruption.

Whilst error wording may not be very useful in and of itself, knowing this makes debugging much easier.

You should also investigate the following additional WordPress problems, as you may be having numerous of them:

  • HTTP 503 Service Unavailable — The server is down.
  • HTTP 502 Bad Gateway — Anytime too many visitors overload the server, this error is caused.
  • ERR_CONNECTION_TIMED_OUT — An overloaded or slow server may be responsible.
  • ERR_CACHE_MISS — If this error occurs, it is likely to be caused by your website's cache or by PHP tools like plugins.
  • 500 Internal Server Error — This error usually results from file corruption on the server.
  • Error Establishing a Database Connection — This issue may be caused by a corrupt database or a database server issue.

How to fix this critical error?

We will discuss 9 ways to resolve "there has been a critical error on this website"

Enable debugging in WordPress

Among the first actions you should do if you're having problems with WordPress is activate debugging. With debug mode enabled, you'll be able to see all of the PHP errors that are happening on your site, which you may use to track down the source of the problem.

Allowing debugging with CyberPanel is fairly simple if you're hosting with CyberPanel.

  • Login to CyberPanel dashboard
  • Enter websites -> list website from the left hand side menu
  • Enter File Manager
  • Open wp-config.php in public_html folder
  • Enter the following code at the end of the file.
define( 'WP_DEBUG', true );

define( 'WP_DEBUG_DISPLAY', false );

define( 'WP_DEBUG_LOG', true );
There Has Been A Critical Error On Your Website

Your site's debugging is now enabled, and failures will be recorded in the log. The debug log, named debug.log, can be found in the wp-content folder.

Look for names in your theme or plugins that indicate they are the source of the problem or links to a specific file. Even if you're not sure what to do about this info, save it somewhere safe since it may come in handy if you need to seek help.

Remember to remove these lines of code once you've completed debugging.

Rollback your website

When WordPress issues occur, restoring a backup can be simple and quick. While it may not always solve the problem, it's worth a try. You may also be allowed to redo your efforts if the problem occurs again.

Before restoring your live site, test it on a staging/testing site to make sure it's working and that you're not erasing your hard work.

Revert to a default theme

A dispute within your theme can sometimes be dated directly to a critical fault. The best approach to check for this is to delete it and revert to the default theme, which should fix the problem right away.

Make a backup of your site first, as you'll need a mechanism to recover your theme files if they go missing. You may lose your personalized styling if you simply reinstall the theme.

  • Enter your WordPress dashboard
  • Click on Appearance -> Themes from the left hand side menu.
  • Activate a default theme like Twenty Twenty-One.

Disable all plugins

A plugin is frequently to fault when you're experiencing a critical problem. Finding the plugin that's causing the problem can be difficult if your site has many or even hundreds of plugins.

But there's a quick approach to figure out which plugin is causing the issue: turn them all off and see whether that solves the problem. If it does, turn them on one at a time until your site stops working. And there you have it: the perpetrator!

  • Enter your WordPress dashboard
  • Click on Plugins -> Add new from the left hand side menu
  • To choose all of them, check the checkbox at the top of the list. Then go to Bulk Actions -> Deactivate, and that's just to resolve any problems and get your site back up and running.

Raise the PHP memory limit.

Even when a plugin or theme is to blame for your website's failure, the PHP memory limit is frequently to blame.

Because your web server only has so much RAM (memory), WordPress places a strict limit as to how much memory a given PHP script can use. If you go above this limit, you'll get a white screen of death or a catastrophic error.

Although you don't want to set the RAM limit too high and enable misconfigured scripts to bog down your site, the default setting is likely too low. Increasing your PHP limit just a little bit could solve your faulty website right away.

  • You can raise the limit by entering the file manager of your site using the CyberPanel dashboard
  • Enter the public_html -> wp-config.php
  • Enter the following code right before the final line and save the code
define( 'WP_MEMORY_LIMIT', '128M' );

You can also raise the PHP memory limit using CyberPanel Dashboard

  • Enter the CyberPanel dashboard
  • Click on PHP -> Edit PHP config from the left hand side menu
  • Select the PHP version
  • Reset the memory limit

Raise the max upload file and text processing functions

A little adjustment to a few PHP functions could be able to cure the critical issue if you're only seeing it in particular instances and not on every page.

When you upload large files and get an error message, it's probably because the maximum upload file size is too little, however increasing the recursion and backtrack limitations can fix certain large sites breaking.

  • You can raise the limit by entering the file manager of your site using the CyberPanel dashboard
  • Enter the public_html -> wp-config.php
  • Enter the following code
ini_set('upload_max_size' , '256M' );
ini_set('post_max_size','256M');

Fix the breaking of large pages on your site, add this code:

ini_set('pcre.recursion_limit',20000000);

ini_set('pcre.backtrack_limit',10000000);

You can also achieve this directly from the CyberPanel dashboard

  • Enter the CyberPanel dashboard
  • Click on PHP -> Edit PHP config from the left hand side menu
  • Select the PHP version
  • Change the max upload file size and post max size
  • Click on the Advanced option and find the recursion limit and backtrack limit and edit it.

Clear your site's cache

Caching is a fantastic technique to accelerate your website, and it's almost always a good thing. However, the cache can get corrupted, resulting in issues on your site.

When this happens, clearing the cache is a simple remedy that ought to be all you need to solve the problem and get your site back up and running.

With CyberPanel you get LiteSpeed Cache. and clearing that cache is super easy

  • Enter the WordPress dashboard
  • Click on LiteSpeed cache -> Toolbox from the left hand side menu
  • Click on Empty Entire cache

Upgrade your PHP version

Your site may break due to outdated PHP, and additional issues are almost certain to arise. You should generally run your site on the most recent version of PHP that WordPress supports, which is presently PHP 7.3 through 8.0.

Several WordPress users prefer to stick on PHP 7.4 because of theme and plugin stability concerns. Normally, this isn't a problem.

Before you attempt a PHP upgrade, ensure sure you have a backup prepared.

  • Enter your CyberPanel Dashboard
  • Click on Websites -> List website from the left hand side menu
  • Click manage for your site -> Configuration -> Change PHP

Check for Malware

Malware can sometimes generate a serious error, especially if you're seeing weird PHP scripts that can't be linked to your plugins or theme. It's difficult to remove malware when you're locked off of your website and can't even perform a scan.

It's difficult to distinguish between legal files and those added by malware, and deleting arbitrary core files isn't going to help. Malware can also alter PHP files, hiding dangerous scripts that aren't visible unless you're a developer.

Check out our article on how to remove WordPress malware.

If you feel malware is to blame, you should seek assistance from your web host. Customer service at CyberPanel is excellent.

Conclusion

If you receive the warning "There has been a critical error on your website," don't panic.

Simply look for a message from WordPress in your inbox to identify the problem and promptly resolve it.

Even if you don't get the email, there really are five options for resolving the issue:

  • Look through the site's error logs.
  • Use the debug mode in WordPress.
  • Identify and resolve any possible theme or plugin issues.
  • Use backup files to restore the site.
  • Upgrade the PHP version on the site.

Several reasons cause WordPress critical errors, but PHP is the most common cause. Either the PHP memory limit is reached, or plugins or themes are not functioning properly.

Rolling back your website is the easiest way to fix the problem if you have a backup, but you can also increase the PHP memory limit or find and uninstall a problematic plugin as an alternative. 

When you need help with WordPress, a hosting service such as CyberPanel can provide assistance. If you aren't sure how to proceed, consult the experts.

Leave a Reply

Your email address will not be published.

chevron-down