DEV Community

Cover image for What is "White Screen of Death ๐Ÿ’€" (WSoD), and how do you detect it in time?
Kasper Andreassen
Kasper Andreassen

Posted on • Originally published at alertdesk.com

What is "White Screen of Death ๐Ÿ’€" (WSoD), and how do you detect it in time?

โš ๏ธ NOTE: This article and its solution are based on our own product - Alertdesk, which is a paid product. If you have an alternative solution to the problem, feel free to post it in the comment below.

Website errors. They come in all shades and are every website owner's fear.

What if I told you that there was an error so cunning that it was named after Death itself? Then you would be scared. Very scared ๐Ÿ˜ฑ

If we turn down the drama a bit, then "White Screen of Death" (WSoD) is an extremely irritating error. Why?

  • It makes your page inaccessible to visitors.
  • It can shut you out of your backend (e.g., the WordPress admin area).
  • It can occur suddenly and without you making any changes yourself.
  • Most "Uptime Monitoring" services will not necessarily catch the error.

To put it mildly, it's annoying as hell.

But what exactly is the "White Screen of Death," and how does it occur?

What is White Screen of Death?

Alt Text

"White Screen of Death" is an error that gives the visitor a white/blank screen. There is often no information about the error, just the color white as far as the eye can see.

It may occur as a result of a PHP and database error. Therefore, it also affects many CMS', including Magento and PrestaShop.

But where the error is most prevalent is probably at the world's most popular CMS, WordPress, where it has even found a place in the official documentation. Therefore, this article will also be based on WordPress.

The most common cause of a WSoD-error is a faulty plugin or theme. Other reasons can be:

  • A syntax error in the code - e.g., if you have made edits yourself.
  • The Memory Limit is set to low in either your wp-config.php file, .htaccess file, or php.ini file.
  • A failed auto-update of WordPress - e.g., due to a server timeout.
  • Problems with your File Permissions.

How do you fix it?

You start by finding out what is causing the error. It may sound easier said than done when all you have to work with is a blank screen. But fear not.

WordPress has a built-in debugging mode that makes errors visible on your page.

To enable it, open your wp-config.php file and find the following line:

define( 'WP_DEBUG', false);
Enter fullscreen mode Exit fullscreen mode

Then change false to true, so it looks like this:

define( 'WP_DEBUG', true);
Enter fullscreen mode Exit fullscreen mode

Error messages will now be visible on your page.

๐Ÿ’ก Tip: If you are not that much into messing with files, then the WP Debugging plugin does the same (obviously requires you to be able to get into the WordPress admin area). However, this is Dev.to so this properly isn't the case.

In the vast majority of cases, it will be a plugin that is causing the error. You will be able to see the name of the plugin in the error message.

If you have access to your WordPress admin area, simply deactivate the plugin on the "Installed plugins"-page.

If you can't access the admin area, you can deactivate the plugin manually via an FTP program or your web host's "File Manager"-tool.

Go to your plugin folder (wp-content -> plugins) and find the plugin that throws the error. Then rename the folder to something else, e.g., from "hello-dolly" to "hello-dolly-1". The plugin will now be disabled.

๐Ÿ’ก Tip: Plugins can also be disabled via phpMyAdmin and WP-CLI - I just find this solution the easiest.

Reload your page and see if the issue is resolved.

What can be done to detect it in time?

One of the most annoying things about the WSoD error is that it can occur suddenly - even without you actively changing anything on your website.

What's worse, if you have traditional "uptime monitoring" enabled, it will not necessarily catch the error.

Alt Text

Yes, you read that right. Most services, including Alertdesk, look at your siteโ€™s HTTP status code. If the page gives a status code 2XX or 3XX, it gets interpreted as up, where status code 4XX and 5XX gets interpreted as down.

"There's got to be a better way!" you may think - and for fear of sounding like a classic American infomercial: Yes, there is.

Alt Text

When you set up an Uptime-check in Alertdesk, you have the option to set up specific "rules" for that check. We call this Assertions.

One of the rules you can set up is that a piece of text must be present on the page in order for it to be "up".

This is a super powerful tool when it comes to checking for WSoD errors.

If the text is not visible (which it won't be in the event of a WSoD error), your check will get marked as "down". You will then get notified immediately by E-mail, Push, Slack, or the channel you have selected.

How to set up an Uptime-check with Assertions in Alertdesk

Start by creating an account on Alertdesk. Go to Monitoring, click the "Add check"-button and choose "Uptime check". Enter your URL and click the "Advanced settings"-toggle in the right corner.

Scroll down to Assertions and select "Text body" under "Source", Contains under "Comparison," and then paste the piece of text that should be present on your page under "Target" (is case sensitive). Then click the Add-button.

Alt Text

โš ๏ธ NOTE: There may be issues with special characters, as they may be converted to HTML characters instead, which will not match. Therefore use text without special characters.

Then click the Next-button. Select who to notify and then click the Next-button again. Give your check a name and make sure everything looks fine. Finally, click Save check, and you are done.

Easy peasy lemon squeezy ๐Ÿ‹

You will now get notified immediately if your website should get a โ€œWhite Screen of Deathโ€ error.

Top comments (4)

Collapse
 
tricia05 profile image
Tricia05

May I know what website monitoring you are using that can detect WSoD?

Collapse
 
kaspera profile image
Kasper Andreassen

At the time of writing I was using Alertdesk. However, any tool that support keyword-based monitoring can do this, e.g. UptimeRobot.

Collapse
 
crestiancik profile image
Crestiancik • Edited

Wooow, I did not even know that this error is being called as "White screen of death" :DD, that is pretty hilarious actually :DD. So, you want to tell me that those steps can actually help me avoid this kind of errors?! I am not that sure about it actually, as I have tried a couple of them, and nothing has actually changed. Moreover, one of those "solutions" actually broke my laptop :DD. I had to call for the services of starlabs.com.sg/laptop-repair/ so they would actually fix it, as it did not respond, not at all.

Collapse
 
kaspera profile image
Kasper Andreassen

The more you know ๐ŸŒ