Nothing causes more dread for a WordPress site owner than encountering the blank white screen of death. Rather than your usual dashboard or homepage, you’re met with a void-like white expanse. But the WSOD isn’t necessarily a death knell.
Targeted troubleshooting combined with simple fixes can bring your site back from the brink. Let’s shed some light on defeating the dark scourge of the WordPress white screen.
What Causes the White Screen of Death
The white screen of death, commonly abbreviated as WSOD, occurs when there is a fatal PHP error on your WordPress site that prevents pages from loading properly. Here are some of the most common culprits behind the WSOD:
PHP Errors
PHP errors usually occur when there is a problem with your theme or a plugin. For example, an outdated plugin may cause conflicts with the current WordPress version. PHP errors can also happen due to server configuration issues.
Database Issues
Problems with the WordPress database, such as corruption or missing tables, can also lead to the WSOD. Issues with database permissions, connectivity problems or outdated database software can prevent WordPress from accessing the database correctly.
File Permission Errors
Incorrect file permissions on WordPress core files or folders can result in not being able to access/edit key WordPress files, triggering the WSOD.
Exhausted Resources Limits
Resource exhaustion problems like hitting max execution time, memory limit or usage limit can lead to a crash and white screen of death. This usually indicates underlying performance issues.
How to Diagnose the Cause of the Problem
Pinpointing the reason behind the WSOD is key before attempting to fix it. Here are the main methods for diagnosing the issue:
Check Error Logs
Error logs record PHP errors and exceptions so checking them should be the first troubleshooting step. The locations of error log files depend on the server and configurations but common folders include:
- /var/log/httpd/
- /var/log/apache2/
- /var/log/nginx/
Look for PHP errors, file not found exceptions, or fatal crashes in the logs.
Disable All Plugins
Rename the plugins folder to “plugins-old” via FTP. This disables all plugins without deleting them. If the WSOD goes away, a plugin is likely causing it.
Switch to a Default Theme
Similarly, replace the current theme folder with a default one like TwentyTwenty via FTP. If the WSOD persists, a theme is likely not the culprit.
Test on a Staging Environment
Migrate the site to a local staging server to isolate the issues. Test activating plugins and themes one by one to identify any incompatibilities.
5 Ways to Fix the Dreaded White Screen of Death
Once you diagnose the probable cause, try these fixes to restore your site.
1. Increase PHP Memory Limit
If increasing the PHP memory allocation resolves the WSOD, the crash was likely caused by exhausted memory.
To increase the memory limit:
- Shared hosting: Use a php.ini editor plugin or contact your host to increase the PHP memory limit setting.
- VPS / Dedicated hosting: Edit wp-config.php file to add:
define(‘WP_MEMORY_LIMIT’, ‘256M’);
2. Fix File Permission Errors
If file access issues are causing the WSOD:
- Assign ownership of the WordPress directory to the user account your web server processes run under:
chown -R user:user /var/www/html/wordpress
- Ensure permissions of key files match recommended settings:
find /var/www/html/wordpress/ -type d -exec chmod 755 {} \;
find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;
3. Roll Back Recent Theme / Plugin Changes
If the WSOD started after changes like updating plugins, switching themes, etc, roll back the changes by:
- Reverting to a previous theme version
- Disabling recently updated plugins
- Rolling back recent WordPress updates
- Then test if the WSOD is resolved.
4. Refresh Database Permissions
If database access issues are causing the trouble:
- Double-check that the database user account has full privileges.
- Reset database permissions with the following command:
FLUSH PRIVILEGES;
- Regenerate the wp-config.php file in case credentials change.
5. Fix Underlying Server Configuration Issues
For server-related causes like max execution timeouts, adjust the PHP configurations:
- Increase max_execution_time, memory_limit, post_max_size etc.
- Check for mod_security firewall rules blocking legitimate requests.
- Make sure PHP extensions like mysqli, curl, etc are installed.
For other issues like database or file system errors, troubleshoot the server accordingly.
Prevent the White Screen of Death
While frustrating, the WSOD can be avoided by:
- Keeping WordPress and all plugins/themes updated
- Establishing staging sites for testing changes first
- Setting up automated backups in case quick rollbacks are needed
- Monitoring site logs to catch issues early
- Optimizing code and resource usage
- Adding security protections against attacks
Acting preventatively beats dealing with the WSOD!
Takeaway
The white screen of death can make even experienced WordPress users pull their hair out. But systematically troubleshooting the possible causes and methodically trying fixes can help rescue your site. With some diligence, the dreaded WSOD can be defeated!