There was a problem loading the comments.

There Has Been a Critical Error on This Website | WordPress

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

The “There has been a critical error on your website” is an alarming message for WordPress site owners. It blocks users from visiting the website, and in some cases, you can’t even get into the admin panel. Luckily, it’s possible to fix this issue without taking too much time. This article will discuss the “There has been a critical error on your website” message means and five methods to fix it.

 

What Does “There Has Been a Critical Error on Your Website” Mean?

Some WordPress errors may block you from accessing the dashboard, displaying the message, “There has been a critical error on this website. Please check your site admin email inbox for instructions.”

 

80693ce452d9327b3bc40159c6509dfaa7714a959444e61ca16bef9ed370c24c909c0a83f3044acd?t=af61b6d3209d100d062ff8834664d9ac

 

This message means that there’s a fatal PHP error on the site. It occurs when a PHP script stops running and is unable to complete its process. To help its users, WordPress has a feature that detects when a plugin or a theme causes a fatal error and sends a notification to the admin email address. In the email, users receive more details about what is causing the issue.

 

a34a108ab1f1c7c3ca1d2b953976c2e689110efd428211feaa8ef27e231b17f8272a5ede29088de7?t=0a0fdcd81d27787b9f6ccb0f0996bdb3

 

The email also contains a URL to access the site in recovery mode. Click the link to safely log in to the WordPress dashboard and fix the issue. If you encounter this WordPress error and don’t see any email notification in your inbox, check your spam folder. However, there may be cases when site owners don’t receive the email and have to locate the issue by themselves.

 

5 Ways to Fix a Critical Error in WordPress

To fix a critical WordPress error, you have first to locate the cause of the problem. The notification email from WordPress provides more details about which file and line of code caused the issue, but don’t worry if you didn’t receive it.

 

There are five methods to locate and resolve the critical error in your WordPress site.

 

1. Check Error Logs

The first method is by checking the error_log file, which stores PHP error information. Use the File Manager of a File Transfer Protocol (FTP) client on your hosting account and go to home/[username]/public_html/error_log or home/[username]/path-to-wordpress/error_log.

 

The file records four types of PHP errors – warning, notice, parse, and fatal. At the beginning of each log, you’ll see the type of error that was found. If you find a parse or fatal error, you’ll have to fix it.

 

 

If you can’t locate the error_log file, ask us for help. Keep in mind that the error_log file will only be available if you enable PHP error logging. To do so, configure the PHP settings from your cPanel.

 

acb63110b0fd244a871a670cf7d7b0ca276c823be4505f00ecb2ae89353672f8306e24e6676c1431?t=d94ce00f7c3ce9d765364611497c13c6

 

If you still can’t check the error log file, try the following method using the debug mode.

 

2. Debug WordPress

WordPress comes with a built-in debugging system that identifies code errors in the core software, themes, and plugins.

To activate the WordPress debug mode, open the wp-config.php file in your public_html directory. Then, find the following lines:

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', false );
define( 'SCRIPT_DEBUG', false );


The “false” values mean that WordPress debug mode is deactivated. Replace “false” with “true” on all lines to activate it. These four lines contain PHP constants. When they’re activated, they perform the following tasks:

 

  • WP_DEBUG – triggers the debug mode in WordPress.
  • WP_DEBUG_DISPLAY – shows debug messages on the pages’ HTML.
  • WP_DEBUG_LOG – stores error details in the debug.log file.
  • SCRIPT_DEBUG – runs the “dev” versions of core CSS and JavaScript files instead of the minified versions.

 

If you can’t find those lines in the wp-config.php file, simply add them to the script. Remember to input the “true” value on each line.

After enabling the debug mode, refresh your site. You should see the details above the error message.

 

74b7ab71cb1b9b59a961f43f9844dc550462ce2926c5f38ac5b653eba542fffb4c55672598530f51?t=2b948359c4834d3e5f760bd901826580

 

Fix the issue according to the instructions, and your site should work normally again. Deactivate the debug mode by changing the values to “false” once you’ve resolved the problem.


3. Solve Any Theme or Plugin Conflicts

The following method will help find conflicts in your theme and plugins. Start by checking your theme. If you have access to the WordPress admin area, simply switch the active theme to a default one such as Twenty Twenty.

 

However, if you can’t access the admin panel, use the File Manager or an FTP client like FileZilla and go to public_html -> wp-content -> themes. Find your active theme’s folder and rename it into youractivetheme-disabled. Alternatively you can issue following command at on Terminal to switch to a default theme;

 

# wp theme activate twentytwentytwo 

 

 

 

Once you’ve done that, reload the site. If it loads as expected, then there’s a conflicting theme present, and you may have to roll back to the theme’s previous version or get an entirely new theme instead.

 

On the other hand, if the error persists, you should check if there’s an issue with your plugins. The process is similar to checking your theme. If you have access to the WordPress admin panel, disable all plugins. If you can’t access the admin panel, use the File Manager or an FTP client and go to public_html -> wp-content -> plugins. Rename all plugin directories into plugin-disabled except the Elementor plugin folder if you have it installed.

73f176b64d3d08cd781638343c6ec8d1a87cbd72a896ad0d983bc4eb2fa48aac7dfa88253cc55e00?t=ffaf3d33235a6c595b73d5d4743ee058

Refresh your site. If it loads normally, that indicates a conflicting plugin.

 

To find out exactly which plugin caused the error, you have to reactivate them one by one, reloading the web page every time. If you’ve renamed your plugins’ folders, go to public_html -> wp-content -> plugins. Revert all plugin folders into their original directory names one by one. Alternatively you can issue following command at on Terminal to disable a plugin;

 

 

# wp plugin deactivate -all 

 

 

 

Raise the PHP Memory Limit

Even if a plugin or theme is the cause of your broken website, the PHP memory limit is often the real one to blame.

 

What is the PHP memory limit? Your web server only has a certain amount of RAM, or memory, so WordPress sets a hard limit on how much memory a single PHP script can take up. When this limit is exceeded, you’ll encounter the white screen of death or the critical error.

 

While you don’t want to set the memory limit too high and allow misconfigured scripts to slow your site to a crawl, the default value may be far too low. Raising your PHP limit just a bit could instantly fix your broken website.

  • Step 1: Access your site through FTP and open wp-config.php.
  • Step 2: Insert the following code right before the final line and save.

define( 'WP_MEMORY_LIMIT', '128M' );

afd2c99db10bb3a2b54952ee5010cf8f57b4f8e2c20a190f0e388f5f4fce2559e207a3bab5614979?t=399d74daa100bf6e294a66a771208738
Defining the memory limit in wp-config-php.

You can also try 256M if this doesn’t fix the issue, but anything higher is definitely unnecessary unless specifically called for in plugin documentation. If the issue is with the memory limit, the plugin you’re using is almost certainly broken and needs to be disable

 

Raise the Max Upload File Size and Text Processing Functions

If you’re only seeing the critical error in certain situations and not constantly on every page, a small tweak to a few PHP functions might be able to fix it. Uploading large files and finding yourself on an error screen is probably a result of the max upload file size being too small, while certain large pages breaking can be fixed by increasing recursion and backtrack limits.

 

First, check what your maximum upload size is and compare it to the file you’re trying to upload. You can find this by visiting Media > Add New and checking beneath the file uploader.


a9bbd3416979c489fad7dcbe7a0c475e7a54c394e99a2beea553fb5e80a359c18be22b0f4096ffd6?t=d3e11f1815533affd0a1349e46597a39
Checking the maximum upload file size in WordPress.

 

To fix either of these issues, you’ll need to log into FTP and edit the wp-config.php file, placing the new code right above the final comment line.

 

To increase the max upload file size, add this code:

ini_set('upload_max_size' , '256M' );
ini_set('post_max_size','256M');

 

And to fix the breaking of large pages on your site, add this code:

ini_set('pcre.recursion_limit',20000000);

ini_set('pcre.backtrack_limit',10000000);

 

 

4. Restore the Site From a Backup

Using this method, you need to restore the website files from a backup. An error like this is one reason why backing up your WordPress site is essential.

 

5. Upgrade PHP Version

WordPress requires PHP 7.4 or greater. Check the PHP version on your web host, and if you find you’re using an older version of PHP, upgrading it to 7.4 or greater can fix the “There has been a critical error on your website” error.

 

 

Conclusion

There’s no need to panic if you encounter the “There has been a critical error on your website” message. Simply check your email address and find an email from WordPress to locate the issue and quickly fix it.

 

Even if you don’t receive the email, there are five ways available to resolve the problem:

  • Check the site’s error logs
  • Use the WordPress debug mode
  • Solve potential theme or plugin conflicts
  • Restore the site using backup files
  • Upgrade the site’s PHP version

 

We also recommend creating backups regularly. Therefore, you’ll be able to restore your site quickly if you get a WordPress error message such as this.

 

Note:  You may also want to check into these other WordPress errors, if you are experiencing multiple of them:

  • ERR_CONNECTION_TIMED_OUT — Caused by a slow or overloaded web server.
  • ERR_CACHE_MISS — If you see this, look into your website’s cache or PHP tools like plugins, as they’re very likely the cause.
  • 500 Internal Server Error — A serious error that can usually be traced back to server file corruption.
  • Error Establishing a Database Connection — Corruption in your database or a database server issue can be the root of this problem.
  • HTTP 503 Service Unavailable — Indicates an issue with your server.
  • HTTP 502 Bad Gateway — Yet another server issue, often caused by too many visitors overloading it.

And if you see any of the above or other strange errors, please raise a support ticket with a screenshot of the error.

 

Reinstall WordPress

If the issue is not found in plugins, themes or PHP configuration, a corrupt WordPress core file or malware could also trigger the critical error in WordPress. The easiest way to fix this is by reinstalling WordPress. You can issue following command at on Terminal to force reinstall WordPress core;

 

# wp core download --skip-content --force

 

 

If nothing works, contact us for a chargeable code fix for your website.


Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  


Self-Hosted Help Desk Software by SupportPal
© Indichosts.net