How to Fix the WordPress White Screen of Death?

Nadejda

· 02nd January 2022·Wordpress, PHP, Hosting, Website Maintenance, Fixing WordPress errors

Excerpt

Are you getting a blank white screen when loading your WordPress website? The famous white screen of death is one of the most common WordPress errors. It’s also extremely frustrating as there is no exact message explaining the issue, and you are locked out of your own site.

How to Fix the WordPress White Screen of Death?

Are you getting a blank white screen when loading your WordPress website? The famous white screen of death (see below -- literally just a white screen) is one of the most common WordPress errors. It’s also extremely frustrating as there is no exact message explaining the issue, and you are locked out of your own site.

This can seemingly happen randomly, or it can happen when you update a theme or plugin. It may happen on your whole website, or just on a specific webpage or WordPress admin area. Sometimes, it can be visible only for a specific post.

In this article we will explain the reasons for the WordPress white screen of death, and also explain how to fix it. The cause is almost always a PHP error that we need to find and solve.

As always, make sure to have a backup of your site prior to making any changes.

WordPress white screens of death

In this guide we will show you how to fix the WordPress white screen of death. If you want to save time, why not subscribe to our Fixed.net WordPress Maintenance Service and you will never have to worry about issues like this again?

Why does the white screen of death appear?

The white screens of death represents a PHP error. PHP is the coding language that WordPress (and most other websites) are built in. When PHP cannot process your webpage, it throws an error and stops processing.

  • Sometimes, the WordPress hosting server kills the script for security.
  • Often, your WordPress site may have hit a memory or time limit set in the PHP configuration.
  • Sometimes there could be a bug in a plugin or theme that causes what we call a FATAL ERROR.

Also, there could be a server related issue.

In most instances, a backup restore will not fix the problem.

The first step is always to establish the cause of the white screen.

We will show you how to do this, before showing you how to remediate the problem.

Are all of your sites affected?

Before you start debugging your actual site and WordPress plugins or themes, it is best to check the hosting provider is not having issues. It may seem obvious, but we have all spent hours trying to find the cause of what we thought was a really complex WordPress problem, when it turns out it was an issue with the underlying provider.

The hosting related causes could be one of many, and obscure. Potentially the actual PHP installation on the server is broken, or the web host has capacity issues. Because the page is at least loading a white screen, you know that the server is not fully down.

One obvious way to check - if you have more than one WordPress site on your hosting account, check to see of the problem occurs on all of them. You can also try and load yoursite.com/readme.txt (replace yoursite.com with your actual website) to see if the website loads the readme file that is already there.

If this happens on multiple sites at once, then it most likely indicates that the problem is probably connected to your hosting service. This can be simply a temporary issue with their service, and you need to contact their support for further information.

Checking error logs

When PHP throws an error, it is usually possible to log that error. WordPress tries to do this itself with debug mode, but before we get there we will check the web hosting error log.

  1. Log into your hosting account (e.g. cPanel) or the webspace via FTP
  2. Navigate to the root folder of your WordPress installation
  3. Look for a file called error_log
  4. If it is there, open that file and scroll to the end. You should see a line that says FATAL ERROR

If you do not see an error log, you may be able to enable error logging in your control panel's PHP settings. Once done, reload the white screen and then try the above steps.

Displaying errors

You can also set your web hosting account to display errors on the white screen. This means that instead of showing the white screen you will see the actual error printed on the page. This is done in either your hosting control panel (set display errors to on), or you can achieve this through a php.in file:

  1. Create a file called php.ini in your WordPress directory folder, or open one if it already exists.
  2. Add a line (or edit it if it exists) that says

    display_errors = on

  3. Save the file then reload the page.

With luck, you will now see this error printed. Be sure to repeat the above and set display_errors to off afterwards. This error is visible to anyone who visits your website.

WordPress Debug Mode

If the issue lies within a theme or plugin, then WordPress may be able to detect it.

Introduced in WordPress 5.2, the fatal error protection feature can in some cases detect the error, so that the white screen may not even appear. Instead you will see the following message:

This site is experiencing technical difficulties

You may also get an email sent to the WordPress admin contact with the subject: "Your site is having a technical issue." An example of the email is shown below. As you can see this even gives the example of which plugin is showing the error.

In the email message you can see the faulty plugin, as well as a specific link.

This link is a special link which lets you log in to Recovery mode. This mode allows you to log in and deactivate the theme or plugin which is causing the issue and which is highlighted in the email. If you have no email for recovery option, then you need to do this process manually.

recovery mode

Showing WordPress Debug Errors

If we do not get an email with the cause, we can use the WordPress debug mode to show the error in a debug log file or on the actual homepage.

To do this you need to edit your wp-config.php file. You should set the following:

define( 'WP_DEBUG', true );

You can also use two more variables optionally.

define( 'WP_DEBUG_LOG', true );

This sets whether to log errors to a file called debug_log in your wp-content folder.

define( 'WP_DEBUG_DISPLAY', true );

This sets whether to show errors on your homepage.

With the combination of the above methods we should be able to establish the actual cause of the WordPress white screen of death. Now that we have the cause we can try and fix.

PHP Memory and Execution Limits

By far the most common cause of a white screen of death is if your site has hit a PHP limit. These are limits set on your hosting which restrict the amount of resources a PHP process (like a webpage load) can use. A web host has to have caps because resources are finite, and also scripts may be broken. If you have an infinite loop in your code, then you have to have a point at which the server kills your script.

The two limits you are most likely to hit are memory limits and execution time limits.

Memory limits are the amount of server memory that a script can use. If you are processing large amounts of data, or doing a big import or export, then you will be using a lot of memory. WordPress needs a minimum of 256MB of memory to run and at Fixed.net we set up our WordPress sites with a minimum of 2GB of memory.

Execution limits are literally just the time in seconds that a script can run for before timing out. A sensible default is 30 seconds, but if you are doing a big import or loading a big list of orders in WooCommerce it may take longer.

Note that as your WordPress site grows, the amount of memory and time you need will also grow. This is why you might just suddenly start receiving a white screen of death. It is also while rolling back to a backup may not necessarily fix the error.

Solving PHP memory an execution time limits can be done in two ways. First, you could just increase the limits. This is done through your web hosting provider or in your wp-config.php file. In your wp-config.php file you can set the following for the memory limit.

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

PHP execution time is set by your hosting provider or in your hosting control panel.

Alternatively, if the high memory or execution limit is caused by a plugin error or bug, you can find and fix this bug.

Disable all plugins

If the previous step was of no help, or if your memory limit is as high as you can go, then it’s time to troubleshoot.

In most cases, the problem lies within a theme or a plugin. The error message may give you a clue to the plugin culprit, but if not you should disable plugins.

This can be done from your admin area in WordPress, click on Plugins – Installed Plugins. Select all plugins and then Deactivate, located under the Bulk Actions menu.

Disable all plugins

If you can’t access your admin area, you need to deactivate the plugins from the FTP.

Log in into your site using an FTP client. After that, go to wp-content folder and locate the Plugins folder.

rename plugins

Right-click on the plugins folder and select Rename. Use something like Deactivated plugins.

Deactivated plugins

Now the FTP client will rename the plugins folder.

WP will look for a folder named plugins so that it can load them. when it can’t locate that folder, it will simply deactivate all plugins.

If this resolves the issue, then start activating the plugins one by one so that you can locate the faulty one. Once you do find it, simply replace it with an alternative.

Replace your theme

If the problem is not connected to the plugins, then try with replacing your current theme with a default one.

Connect again to your FTP client, go to /wp-content/themes/folder. There you will find all installed themes on your website.

Download a backup of your current theme, and then delete or rename that folder.

If you have a default theme, such as Twenty Twenty for example already installed on your site, then WP will automatically start using it.

If you do not have one, then you would need to manually install a theme using FTP.

Here are some less common but possible causes and fixes:

  • In some cases, you will access to the backend, but the white screen is located at the front-end. This can be caused by a caching plugin. In this case just empty your cache or disable your caching plugins.
  • If the white screen of death appears only on longer posts, you can add the following to your wp-config.php file:

    ini_set('pcre.recursion_limit', 2000000);

ini_set('pcre.backtrack_limit', 1000000);

  • If your web host runs cPanel with CloudLinux, click to see if you are hitting your CPU LVE limits

The while screen of death can be an extremely frustrating error, and we hope the steps above were able to resolve it.

For further advise and support, don’t hesitate to contact our Fixed Team, we would be glad to help in any way!

Nadejda
Nadejda Milanova