Does your WordPress website display the message “Error establishing a database connection”? Your WordPress website becoming inaccessible to users is a fatal blunder.
Nothing is scarier than when your WordPress website goes down, especially if you get a warning like “There has been a critical error on this website.” Sometimes it might be the WordPress backend that can’t load while the front end loads but in many cases, it is both the front end and back end that displays “There Has Been a Critical Error on Your Website”
You need to know how to correct the major problem right away before you get locked out and the front end goes down completely. As they confront a glaring error screen, visitors are leaving every minute that passes.
Fortunately, repairing this serious error usually only requires adding a quick PHP code or removing a problematic plugin. In this post, we’ll go over a number of strategies to resolve this problem and swiftly restore service to your website. This is a tested method i deployed in solving a client’s issue recently and that prompted this post.
Table of Contents
WordPress’ most iconic error, the White Screen of Death, is probably something you’ve heard of or even experienced if you’ve been using it for a while.
This shocking error would force your entire website to load as a blank white page, occasionally including your backend. The critical error and the statement “There has been a critical mistake on your website” have been added to this blank screen in more recent versions of WordPress.
You can find instructions in your site administrator’s email inbox.
Even while the error message may not be very helpful on its own, being aware of this makes troubleshooting considerably simpler.
You might also want to investigate the following additional WordPress errors because you may be encountering more than one of them:
- ERR CONNECTION TIMED OUT: – A slow or overloaded web server is to blame for the error code.
- If you observe ERR CACHE MISS, investigate your website’s cache or any PHP tools, such as plugins, as they are most likely the culprit.
- 500 Internal Server Problem: This type of serious error is typically caused by server file corruption.
- Error Establishing a Database Connection: The cause of this issue may be a database server malfunction or database corruption.
- HTTP 503 Service Unavailable: – This code denotes a server problem.
- HTTP 502 Bad Gateway: Another server issue, often brought by too much traffic.
Additionally, take a look at these HTTP status codes if you encounter any other odd issues.
In order to help you get your website back up and running, we’ve gathered a number of various viable solutions. Editing core WordPress files may be necessary if PHP is the likely culprit.
Before adopting any of these solutions, please be sure to back up your website even if it is currently broken because we don’t want to make things worse!
It will be really helpful if you can access the backend of your website. But since your entire website is probably down, you’ll need to access it using FTP (or SFTP) or cPanel.
You obtain your FTP login information, get in touch with your site host or check your hosting dashboard. Also, be sure to set up an FTP client like FileZilla. You can login via CPanel and fix things similar to using FTP.
1. Identify what you were doing before this error happened
You might get this issue in WordPress for a number of different reasons, so try to recall what you last did.
- A plugin was either installed or removed.
- Did you enable or disable a plugin?
- Have you uploaded, enabled, or disabled a new theme?
- Have you made any modifications to your web hosting?
- Have you made any FTP updates?
- Did you change the version of PHP?
Try undoing the modification you made if you discovered this problem after making it to your website.
2. Enable Debug (Check logs) in WordPress
Check the error logs by logging in to your site using FTP or cPanel (I used cPanel). Try turning on debug mode if that doesn’t work. To achieve this, open the wp-config.php file located in the WordPress root folder in a text editor after logging in to your website using FTP.
Look for these lines (I basically just used the first line):
define( ‘WP_DEBUG’, false );
define( ‘WP_DEBUG_DISPLAY’, false );
define( ‘SCRIPT_DEBUG’, false );
define( ‘WP_DEBUG_LOG’, false );
Your website now supports debugging, and any issues will be logged. The debug log, which is called debug.log, may be found in the wp-content folder. Look for names of your theme or plugins that indicate they are the problem or that make reference to a particular file.
The error message will be displayed for you to know where the problem is coming from. Save this information even if you are unsure of what to do with it because it may come in handy if you ever need to ask for help.
Once you’re done, ensure that you change these back to false. Visit the support page for debugging in WordPress for additional information. You could check the health tool if you can access the backend of your website.
Sometimes the tension inside your topic is the source of the crucial inaccuracy. The best approach to check for this is to temporarily erase it and go back to the normal theme, which ought to solve the problem right away.
You should first make a backup of your website because you’ll need a mechanism to recover your theme files if they disappear. Reinstalling the theme alone can result in the loss of your personalized customization.
This is simple if you have access to your dashboard. Simply choose the desired theme by clicking on it under Appearance > Themes, and then click Delete in the pop-up window’s lower right corner.
Try downloading and switching to a new theme if you can’t see the choice. The safest bet is to try a default theme like Twenty Twenty.
Follow these directions to FTP-revert to the default theme if you don’t have access to your backend.
- Use CPanel or FTP to connect to your website.
- Go to wp-content/themes and upload the theme which you have downloaded from WordPress official site. Extratct the theme in the repository
- Now your site will revert to the default theme say Twenty-Twenty.
If this solves the problem, then you will know It was a theme conflict. Simply reapply the theme or give the folder its original name to restore your theme files.
- 10 Best Email Marketing Services for Small Business
- 20 Sales and Marketing Tips for Startups
- What Is The Difference Between Search Queries And Keywords?
- 9 Best Free Web Hosting Services you can trust
4. Update your Current theme
In most cases, it is usually an issue caused due to update from the theme developer. If you do not update your theme before such an update, it can cause critical issues and this may be resolved by updating your current theme.
How do I update the theme when I cannot log in?
You can follow the same process as above.
- Connect to your website via FTP or CPanel.
- Navigate to wp-content/themes. Simply upload the new theme which will override the old one.
If this solves the problem then you may not need to read the other options but if it does not solve the issue, then try the next step below.
5. Check All Plugins
If it’s not the theme, there can be a problem with a plugin. Alternatively, you can disable all plugins, which is what I advise, by following the instructions above for each individual plugin.
Use Cpanel or FTP to access your website, then navigate to the plugins folder inside the wp-content folder (wp-content > plugins). Add anything to the folder’s name to disable all plugins at once (like changing plugins to plugins-disabled).
How to use Cpanel or FTP shown below:
- Use Cpanel or FTP to log into your website.
- Locate your plugins by opening the wp-content folder.
- Rename the plugins folder to plugins old and check to see if your website is operational once more.
- Rename the folder back to “plugins” after the check.
You should be able to enter into your dashboard and enable each plugin one at a time because they should all still be disabled.
If the plugins automatically reactivate, rename each plugin folder with the letter _old until your site is fixed.
And if after this task the problem persists then it is not a plugin conflict. Do not be alarmed my dear, for there are other options that work and you need to read on to get the solution you desire.
The majority of the time, caching is only beneficial in terms of speeding up your website. However, the cache might occasionally become faulty, causing your site to display errors.
Clearing the cache is a straightforward fix for this issue, and doing so should be sufficient to solve the issue and get your site back up and running.
Fear not, the cached version of your pages will be restored shortly, allowing your site to load swiftly once again. The corrupted files that are stuck in the cache will be deleted.
Your website may break if the PHP is outdated, and other problems are almost certain. Generally speaking, you should run your website on the most recent PHP version that WordPress presently supports, which is PHP 7.3 to 8.0.
WordPress users who are worried about theme and plugin compatibility sometimes choose to stick on PHP 7.4. This typically won’t result in issues. However, upgrading is essential if you’re still running PHP 5.x as it can lead to significant issues.
Make sure you have a backup prepared before attempting a PHP upgrade because it’s a major issue.
Simply sign in to your administrative dashboard or Cpanel, select Sites > Tools, and then click Modify next to PHP engine.
Choose the desired version. Note that PHP version 7.3, 7.4 and 8 are the recommended versions.
Malware can occasionally be the root of a serious mistake, especially if you notice odd PHP scripts that you can’t attribute to your plugins or theme. It’s difficult to remove malware when you’re locked out of your website and unable to perform a scan.
It can be challenging to distinguish between trustworthy files and dubious ones that malware has inserted, and deleting random core files isn’t going to turn out well. Malware can also alter PHP files to hide dangerous code that, unless you’re a developer, you won’t be able to detect.
It may be preferable to ask your web host for assistance if you think malware is to blame.
Although there are several potential causes for the WordPress critical error, Themes or plugins are sometimes the culprits of some errors in WordPress websites. Simply running a debug is one of the fastest ways to get to the root cause and from there you can know how to fix this.
If you have a backup, rolling back your website will solve the issue the fastest, but there are a number of other solutions you can attempt, such as increasing the PHP memory limit or finding and deactivating a problematic plugin.
Don’t give up if you can’t repair it yourself after trying a few different things during troubleshooting. You can reach out to us and we will be glad to offer our services in helping you solve the problem and get your website running live in no time.