⚠️ 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?
"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.
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);
Then change false to true, so it looks like this:
define( 'WP_DEBUG', true);
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.
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.
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.
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.
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.
⚠️ 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.