There has been a critical error on your website, now what?
Your WordPress site goes blank and you see the following error message: "There has been a critical error on your website" or "Er heeft zich een kritische fout voorgedaan op je website". In this knowledge base article, there is no lengthy introduction; we are going to help you solve the error as quickly as possible.
Identifying the error
The above-mentioned error often has to do with PHP. It could be a memory error, among other things, or there is an error in your theme or plugin. So there are plenty of places where things can go wrong, which is why it is important to identify and isolate the error.
Activating debugging in WordPress
By activating the debug mode of WordPress, you can identify and isolate the errors to find a possible solution.
You can manually activate debug mode by connecting to your WordPress site via SFTP. Use an SFTP client such as Filezilla for this. You can read how to establish an SFTP connection here: https://mijn.host/kb/verbinden-via-sftp-in-filezilla/
- Connect to your website via SFTP
- Find the wp-config.php file and edit it with a text editor or IDE such as Visual Studio Code. This can also be done with a simple Notepad application.
- At the bottom of the document, the following code must be placed and then save it:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
Debug mode is now activated and all errors are now tracked in a log file. You can find the log file in the wp-content folder named debug.log. Check inside this file if you recognize the name of a plugin, note down anything relevant as this may come in handy later with the solutions.
When you are done, you need to take your WordPress site out of debug mode and you do this by removing the three lines of code again.
The solutions
Solution 1: Restoring a backup
Although restoring a backup does not guarantee that the problem is solved, it is worth a try. This is because restoring a backup is quite quick to perform. See the following knowledge base article on restoring a backup: https://mijn.host/kb/back-up-terugzetten-hostingpakket/
Solution 2: Going back to a default theme
It could also be a problem with a theme, you can test this by removing the old theme and going back to a default theme. You must first create a backup of your WordPress site for this, if you simply reinstall the theme there is a high chance that your changes will be deleted.
To change the theme, look for Appearance in the left bar and then Themes. If you cannot connect to your backend, you can also connect to your WordPress site via SFTP.
- Connect to your website via
- Go to the wp-content/themes folder and delete the folder.
- Manually add the default theme Twenty Twenty Do this by downloading the theme and adding it to the themes folder in wp-content/.
Solution 3: Disabling all plugins
Besides a theme, it can also be due to one or more plugins. For this, you will have tn remove, check if the problem is gone and if so you will have to reinstall the plugins one by one and see if it causes problems.
You can deactivate the plugins via the left bar in WordPress. Select Plugins and then Installed Plugins. Next, check the box at the top left to select all plugins and then click on Bulk Actions and Apply. After that, you can enable them one by one by going to Installed Plugins and clicking on Activate for each plugin.
Here too, you can connect to SFTP if the backend is not accessible:
- Connect to your website via
- Select the wp-content folder to see the plugins.
- Give the plugins folder a different name, this can be anything as long as it differs from the old one.
- Check if everything works again.
- Rename the folder back to plugins, the plugins are still disabled and you can activate them one by one via the WordPress dashboard. If you still cannot access this, you can manually reinstall the plugins via
Solution 4: Increase PHP limit
Not having enough memory can also lead to a ‘There has been a critical error on your website’. It is therefore important to check what the current memory limit is set to. Keep the following in mind during this solution: you also do not want to set the memory limit too high. This can cause the website to become very slow because some scripts and plugins demand too much memory. However, slightly increasing the memory can often solve a lot. You can increase the memory limit via SFTP as follows:
- Connect to your website via
- Open the wp-config.php file, open the file with a text editor or IDE
- Enter the following code
define( 'WP_MEMORY_LIMIT', '2568M' );
Solution 5: Maximum file size for uploads and text processing functions
Uploading a file or a photo that is too large, among other things, can lead to a crashed WordPress site. First check what the current limit is, you do this by going to Media and then New file in the left bar in your WordPress dashboard.
After you have checked that, it is time to log back into SFTP:
- Connect to your website via
- Open the wp-config.php file, open the file with a text editor or IDE
- Enter the following code below each other to increase the limits:
ini_set('upload_max_size', '256M' );
ini_set('post_max_size', '256M' );4. If your site crashes on large pages, add this code:
ini_set('pcre.recursion_limit', 20000000);
ini_set('pcre.backtrack_limit', 10000000);
Solution 6: Clear your cache
Clearing cache is often the solution for problems with websites, you can see it as a quick on-off switch so you can start with a clean slate again. You can easily clear your cache via your browser, how you do this varies per browser but the general idea is about the same. For Chrome you go to History and Clear search history, now you also select Clear cache.
Solution 7: Upgrade PHP version
Staying up to date is not only important for the security of your site but also for the functionality between WordPress and your plugins. The version you want to be on at the time of writing is PHP 7.3 to 8.1. MIf you are still on PHP version 5.x, it is important to upgrade your PHP version because this can cause problems with your themes and plugins.
You can easily upgrade your PHP version via the mijn.host Control Panel. Go to your hosting package and open in the menu Advanced > PHP settings.
Solution 8: Check for malware
A final possibility is that your WordPress site is suffering from malware and is therefore no longer working properly. To find out, you can check if there are PHP scripts on your site that you know nothing about. Because this is quite a difficult process, we recommend that you contact us. Our professional support staff will then look at your website and files.
Still have questions? Get in touch.