How to fix WordPress White Screen of Death
How to fix WordPress White Screen of Death, wp-admin white page
1. Check the Apache error logs
Error logs is the first place you should check if your website is not loading. On cPanel servers apache error logs is in location /usr/local/apache/logs/error_log. On servers with no control panel apache logs are usually saved in location /etc/httpd/logs/error_log.
Check the apache/nginx configuration file on your server to find the exact location of the error_log file.
On some servers mod_security rules might be too strict and it will block the site access. Try disabling the mod_security httpd firewall for few minutes and check whether the site is loading.
You must tail the error log file and refresh the site in the web browser.
tail -f /usr/local/apache/logs/error_log
Do the below steps if there are no errors in the apache logs.
2. Enable PHP error logs and Display errors by creating a custom php.ini
You must do the below steps to enable PHP error_logs for your website. It is better to create a custom php.ini file instead of editing the main PHP configuration file because editing main PHP configuration file will affect other sites on the shared server. You must find the location of the php.ini file of your site to enable error logging, display errors.
First you must enable display_errors and log_errors in the PHP configuration file. Ask your webhosting provider to create a custom php.ini file, if your website is hosted on a shared server.
Create a phpinfo.php file under the document root of the website to know the loaded PHP configuration file of your website. You can do the below steps to create a phpinfo file (or you can search “how to create a phpinfo file” in google search engine).
Create a phpinfo.php file using touch command and paste the below content.
< ?php phpinfo(); ? >
The created file might be having root ownership so you must change the ownership of the file as user.
chown user:user phpinfo.php
Above steps are for those who have server root access. Do the below steps if you do not have server root access.
You can create a phpinfo.php file in your PC and upload it to the document root of the website via FTP. phpinfo.php file will show the PHP version and the location of the loaded PHP configuration file (php.ini of the website). cPanel users can create phpinfo.php file via ‘File Manager’ in cPanel.
After creating the phpinfo.php file, you can access the phpinfo.php file in the webbrowser : http://yourwebsite.com/phpinfo.php
Phpinfo file shows php.ini file of my website is in location /usr/local/lib/php.ini. Copy this file to public_html folder to create a custom php.ini file (You must have server root access to copy the php.ini file to your home directory)
Command to copy php.ini file to public_html directory and change ownership of the file.
cp -a /usr/local/lib/php.ini /home/user/
chown user:user php.ini
Edit the below lines in the php.ini file :
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
log_errors = On
Change the above values in php.ini file and restart apache service for changes to take effect. Now check the phpinfo.php file and make sure the php.ini is loading from new location /home/user/php.ini. Also check whether the above PHP values are enabled.
Create an empty php.ini with above contents in /home/user directory, if you do not have server root access.
3. Enable WP_DEBUG – WordPress Debug Mode
You must enable debug mode in the wordpress configuration file wp-config.php. WordPress debug mode will be disabled by default.
Take a backup of the wordpress configuration file before making a changes in it. You can download the wordpress configuration file or take a backup using ‘cp’ command.
cp -a /home/user/public_html/wp-config.php /home/user/public_html/wp-config.php.bakk
Now edit the wp-config.php file of your wordpress website using your favorite editor. Search for WP_DEBUG in configuration file and change the value to true.
Change define( ‘WP_DEBUG’, false);
define( ‘WP_DEBUG’, true);
Save the wp-config.php file and exit.
Now refresh your website in the browser and check whether there is any error on the wordpress site. If the white screen of death is due to PHP errors then it will be shown in the browser and in the backend error_log.
tail -f /home/user/public_html/error_log
4. Try Disabling the wordpress plugins one by one
Go to plugins directory in the wp-content.
You must rename the installed wordpress plugins one by one to find out which plugins is cause white scree of death. Disable one plugin at a time and refresh the site in the browser to check whether it is loading.
mv wordfence wordfence.bakk
In the above example you have renamed (disabled) wordfence as wordfence.bakk. Now refresh the site in the browser and check whether it is loading. If the site is loading then issue is related to that plugin. If the site is not loading then rename the “wordfence.bakk” back to wordfence and rename the next plugin in the plugin directory. Repeat this step till you find which plugin is causing the issue.
You can also disable the wordpress plugin if you have access to the wordpress admin (frontend).
Login to wordpress >> Plugins >> Installed Plugins >> Click on “Deactivate” under the plugin name
5. Change the WordPress theme
Change the wordpress theme if you have access to wordpress admin. Login to wordpress admin and click on appearance >> themes >> Click on “Add new”. Search for a new theme and try switching to it to check whether the white page is a theme related issue.
If you don’t have access to wordpress admin then try changing the theme in wordpress database via phpmyadmin. Search in google “How to change wordpress theme + phpmyadmin”
6. Recently installed Plugins and themes
You might see white page if you have recently installed any wordpress security or caching plugins. Disable all recently installed wordpress plugins.
Revert to old theme if the white screen error started after you switched to a new wordpress theme.
7. Update wordpress, themes and Plugins
If you have access to wp-admin (wordpress admin) then try updating wordpress script, themes and plugins. Updating those might fix the wordpress white page. If you have a new version of wordpress available then dashboard will show “WordPress x.x.x is available! Please update now.”
8. Replace wordpress core files – Try a manual update
Some times the issue might be due to missing wordpress core files, missing codes in the files (partial content) or malicious codes in the files. This should be fixed by doing step G (Update wordpress, themes and Plugins). Try manual update if you do not have access to wordpress admin.
IMPORTANT : You must take a backup of the website before manually updating the website. (Take backup backup of the files and wordpress Database)
Download latest version of wordpress from https://wordpress.org/download/
You can download either in zip or tar.gz format. Upload the tar.gz file to the server via FTP and untar it.
tar -zxvf latest.tar.gz
Replace the files in the wordpress root directory with the files in the extracted tar file. Replace all files in wp-content and wp-admin of your website with the original directories in the extracted file.
Do not delete anything within the wp-content directory (plugins, themes, uploads directories are required and should not be deleted). Replace individual files in the wp-content directory from the core files.
If only one or two files are missing then you can download those files from github : https://github.com/WordPress/WordPress
9. Increase memory Limit
If you see any memory error in the logs like “Fatal error: Allowed memory size of 42056475 bytes exhausted” then try increasing the memory_limit in php configuration file.
memory_limit = 265M
Save the php.ini file and exit.
Restart apache if memory_limit value is not updated in the phpifo.php page.
10. Other Reasons
Empty Index file : Check whether index.php file is empty. WordPress might show white page or error if the index page of your site is empty.
Move .htaccess File : Try accessing the website after renaming the .htaccess file. The site might not load correctly if there are incorrect rules in the .htaccess files.
PHP upgrade : If the white page started after upgrading the site PHP version then try reverting the version to old one.
11. Restore Site from Backup
You can ask your webhosting provider to restore the site from daily backup (or restore to the date on which website was working fine).