How to Fix the WordPress White Screen of Death
There are few things worse than loading your website and seeing a blank, white screen. No error message, no clear problem, just the white screen of death.
The white screen of death remains one of the most common WordPress errors. The worst part may be that it can make your WordPress site inaccessible to not only visitors, but administrators too.
What is the white screen of death?
The white screen of death shows up when an error takes place in a website’s PHP or database. This type of error might also appear as a message, “This page isn’t working and is unable to handle the request,” or “Site is experiencing technical difficulties.” This is known as an HTTP 500 error.
Luckily, the white screen of death can be fixed! The first step is usually determining exactly why the error occurred. The HTTP 500 error is a sort of a generic catch-all for errors that don’t fit in other categories. This means there are tons of possible causes, including out-of-memory issues, mistakes in server configuration, unhandled exceptions, code errors, plugin/theme conflicts, and more.
The fix you need will depend on the exact nature of the error, so the first step of troubleshooting an HTTP 500 error on a WordPress site is to determine its exact cause. In this article, we’ll discuss some of the most common causes for these errors and highlight the solutions for each, including disabling themes and plugins, using a backup, increasing your site’s memory, resolving syntax errors in your code, fixing file permission issues, updating WordPress, and using the WordPress debugging tools.
How to fix the white screen of death by disabling WordPress themes and plugins
A lot of times, a WordPress site goes down because there’s a plugin conflict or a plugin isn’t supported by the version of PHP running on the server. Think about the last 24 hours: Were any new themes or plugins installed on the site? Disabling a recently downloaded plugin or switching themes is often the best place to start, and it’s a relatively simple fix.
If you have access to wp-admin…
Log in and disable the plugin or theme you think may be causing the problem. Once it’s deactivated, do a hard refresh on your site. If it loads, you’ve found the culprit! If you’re still seeing the white screen of deathWSoD, you have two options: you can either disable a different theme or plugin, or you might have a different cause behind your HTTP 500 error.
If you don’t have access to wp-admin…
It’s still possible to disable your themes and plugins via SFTP. Connect to your website, and navigate to the wp-content folder. This is where you’ll find all your site’s theme and plugin files. By renaming the files, you can deactivate the theme or plugin on your site. After you’ve made a change, do a hard refresh on your site. If it loads, that means you found the correct plugin, and you should now be able to log into wp-admin again).
Pro tip: Sometimes the problem isn’t a single plugin, but how they’re interacting with one another. To rule this out, disable all plugins and see if your WordPress site reappears. If it does, reinstall the plugins one at a time, refreshing your site after each installation. When your site disappears again, you’ve likely found the culprit.
Beyond conflicts, outdated WordPress plugins can sometimes cause HTTP 500 errors. If you’ve been putting off updates, we recommend running those to ensure your plugins and theme are up to date.
While you could turn on automatic updates, this may cause issues of its own if the updated plugin or theme has a conflict or bug. This is one area where the right managed host can really help. WP Engine’s Smart Plugin Manager solves this by checking that all updates work as expected and don’t cause any visual problems on your site. If the update does cause an issue, Smart Plugin Manager automatically rolls it back and restores your site.
How to fix the white screen of death by resolving syntax errors
Syntax errors are typically caused by a mistake in your code syntax. You may have accidentally mistyped or pasted in the wrong syntax, and that caused the white screen error. Very often, you can resolve these by simply undoing whatever it was you just did that caused the error.
Things get a little trickier in situations where the syntax error wasn’t directly caused by you. It’s possible that a theme or plugin is throwing this error due to outdated or conflicting code. The nice thing is that the error itself will give you a big clue as to which plugin or theme is causing the issue, by listing the exact file where the issue is.
The easiest way to resolve syntax errors caused by themes or plugins is to roll your site back to the version before the white screen of death. This pushes your site back and restores it to the last backup before the errors were made, rather than having to jump in and edit the code.
Another way to resolve syntax errors would be to edit the file(s) mentioned in the syntax error. Typically, a syntax error will reference a file along with the line of code in which the error is found. While the error message tells you exactly where the error is, you’ll need sharp PHP skills if you want to fix it.
To edit the impacted file(s), you can take two different approaches:
- Download the impacted files via FTP or SFTP, depending on your server settings
- Use a tool offered by your web host to edit a file directly on the server
An FTP client is an application that helps you connect to your website and transfer files using the FTP protocol. Some free solutions include Filezilla and Cyberduck. Once you’ve downloaded the impacted file(s), try to determine the source of the error based on the line code in a text editor, such as Sublime. Once you believe you’ve corrected the syntax error, upload the file back to your server via FTP. Hard refresh your site to see if your site returns to its normal state.
The second option is available if your web host offers a tool to edit a file directly on the server through an online file management tool. If they offer a tool of this nature, you can log in, find the file, make the necessary changes, then save.
Pro tip: You can avoid a white screen of death caused by syntax errors by making site updates in a local environment or on a staging site, instead of your live site. Local is a free solution specifically for WordPress sites that makes it easy to pull a copy of your site for offline editing and push changes live to production.
WordPress debugging tools
WordPress comes with specific debugging systems designed to simplify the process as well as standardize code across the core software, plugins, and themes. Think of debugging as a roadmap to see where an error is coming from and what the root cause is.
To use WordPress’s built-in debugging tools, you’ll need to enable debug mode by editing your wp-config.php file. Note that changing this file can have severe ramifications, so make sure you’re working locally or on a staging site before you try this.
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', true);
Here’s what’s going on:
- `WP_DEBUG` enables debug mode, which allows WordPress to display error messages and warnings.
- `WP_DEBUG_DISPLAY` controls whether error messages are displayed on the screen or logged to a file instead. If you set it to `true`, error messages will be displayed on the screen, but if you set it to `false`, they’ll be logged to a file instead.
- `WP_DEBUG_LOG` enables logging of error messages to a file named `debug.log` in the `wp-content` directory.
It’s worth noting that enabling debug mode can pose a security risk, as error messages can reveal sensitive information about your site. So, make sure to disable debug mode when you’re done troubleshooting. Additionally, debug mode can slow down your site, as WordPress will be logging and displaying error messages.
When you’re ready to view the debug logs, simply look for the `debug.log` file in the `wp-content` directory and open it in a text editor. You can also use a log viewer tool to help you navigate and filter the log messages. As you review the logs, focus on error messages that are relevant to the issue you’re trying to troubleshoot. Remember to disable debug mode when you’re done to avoid performance issues and security risks.You can find more information on the WordPress debugging tools here.
How to fix the white screen of death by using a backup of your site
If you discover a white screen of death error soon enough, one of the easiest ways to get rid of it is to roll your site back to a recent backup before the error occurred. This process can help you pinpoint when the error started, so it’s easier to identify what changed and potentially caused the HTTP 500 error.
Even if you don’t personally take backups of your site, most managed hosting providers automatically run backups of your site and offer a restoration process. If your site is hosted on WP Engine, we take a backup of your site every night and store the last 30 days of backups. You can quickly and easily restore a backup on your own right from the WordPress dashboard. If your site is hosted with a different provider, try contacting them to request a restore.
Once you’ve rolled your site back, you’ll still need to find what caused the error in the first place. Was it a new plugin on the site? An update that didn’t finish correctly? While getting rid of the white screen of death with a backup is good (your site is back up!), remember to take the next step of determining what the cause was, so you don’t repeat the same situation.
How to fix the white screen of death by increasing your site’s memory
Sometimes an HTTP 500 error is caused because your site has maxed out its allocated memory. If you’re getting an error that says “Allowed memory size of xxxxxx bytes exhausted,” that means your site is running out of memory while trying to execute a script or process. This can happen when a plugin, theme, or script requires more memory than what’s allocated to PHP on your server.
There are several reasons why you might see this error. It’s possible that the default memory limit set by your hosting provider or server configuration might be too low for your WordPress site’s needs, or that the site is experiencing a huge spike in traffic or concurrent requests. In these cases, the solution is to allocate more memory.
Note: Most managed WordPress hosts take care of this for you, since it’s a server-level setting. If your site is hosted on WP Engine, just send our support team a message that you need your site’s memory increased and we’ll get it patched up.
The manual solution for this is assigning more PHP memory to the application. This can be done through the `wp-config.php` file on many installs; just add the following code to the file:
To increase PHP memory to 64MB:
define( 'WP_MEMORY_LIMIT', '64M' );
To increase PHP memory to 96MB:
define( 'WP_MEMORY_LIMIT', '96M' );
Note: For security reasons, WP Engine locks down your wp-config.php file and doesn’t allow changes to be made directly to it. We do this because it’s auto-generated by our software and practically everything you’d want to do there is automatically configured for you.
WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there’s no need to set this value to 64M as WordPress will automatically use all 64MB if need be.
Keep in mind that the allocated memory may not be the underlying issue if you’re seeing this error. Inefficient code or database queries can cause memory usage to skyrocket, and these may persist no matter how much you increase allocated memory.
The details of exactly how to fix these issues are outside the scope of this article, but we’ll get you started. The first step to optimizing your database queries is to identify the slow ones that are hogging memory. A plugin like Query Monitor is very helpful in both identifying and optimizing these.
If the issue is concurrent requests, consider implementing caching to reduce the load on your server. In addition, look into using a Content Delivery Network (CDN) to distribute static assets and reduce server load.
How to fix the white screen of death by identifying file permission issues
Having incorrect file and folder permissions can cause errors on your WordPress site during upload, resulting in the white screen of death. File and folder permissions tell the server who can read, run, or modify files hosted on your account. Typically, WordPress will warn you that it can’t edit a file, create a folder, or write to disk. However, sometimes you may not see an error message.
To check what file and folder permissions your site has, connect to your site via FTP. Once you’re connected, go to the root folder of your WordPress site.
From there, select all folders in the root directory and right-click to select “File Permissions.” A new box should pop up with a numeric value. The recommended value is “755,” so if you’re seeing something different, go ahead and change it. Click the “Recurse into subdirectories” checkbox and then select the“Apply to directories only” option. Click “Ok.” Your FTP client will start setting file permissions to folders and subfolders, so give it a few minutes to finish up.
Next, select all the files and folders within the root folder of your WordPress site and right-click to select “File permissions.” This time, the numeric value in the file permissions box should be “644.” If it’s something different, enter the new value, click on the “Recurse into subdirectories” checkbox, and then select the “Apply to files only” option. Click “Ok” to continue.
Now, your FTP client will start setting file permission for all the files on your WordPress site. Give this a few minutes to finish up and then hard refresh.
How to fix the white screen of death by completing a WordPress update
Sometimes WordPress runs into an issue with updates. Most of the time, it resolves itself, but occasionally it leads to the white screen of death.
There are two ways to complete a WordPress update:
- Deleting the .maintenance file
- Manually updating
The first step is to go into your WordPress root directory and see if there’s a .maintenance file. The name begins with a dot, which means it’s a hidden file. If you don’t see it using your FTP program, try logging into your server’s control panel and using the file manager to find and delete it. After deleting that file, load up your site again. If the update was successful, and WordPress just failed to remove that file automatically, your site will load like normal.
If you’re still seeing problems, there’s a chance the update wasn’t successful. In this case, you may need to manually run the update.
Summary
The white screen of death can be caused by a number of problems. While getting your site back up and running as soon as possible is important, keep in mind that understanding the problem and why it happened can prevent future HTTP 500 errors. With these steps, you’ll be able to get your site back up and running in little to no time!