Anyone working with a wordpress based website would have come across this dreaded white screen of death. It is a frustrating and panic settings thing to see that your website has just become a plane white screen and you have no clue of what happened. So what can we do instead of cursing and kicking the table to get our website back online?
The white screen error can happen due to many different reasons, but we can group them into 3 different groups.
- Problem with your server / memory / database
- Problem with your plugins
- Problem with your theme
So when you encounter a white screen error, look for any error detail on the screen. Ask yourself if you have just installed a new plugin, installed a new theme , edited any theme or plugin or wordpress core files, made any changes to the server database settings etc. If you have done any of the above just prior to the onset of the white screen error , then it is most probably what you have done is causing the error.
1. Problems with server / memory/ database
One of the most common error is the “Error Establishing a Database Connection” error. This occurs when wordpress cannot connect to your database. It could be because your server is down, your database name/user/pass credentials have changed , or your database is corrupted somehow.
If you are getting this error on the site front end, proceed to access your wp admin panel ( yoursite.com/wp-admin) . If there is a database error you are most likely to see a more specific error message like this “One or more database tables are unavailable. The database may need to be repaired “. In that case you can add the following to your wp-config.php file.
This will give you an option to repair and optimize your database through the admin panel. Mostly that should fix it.
Another error that could disable your site is the memory exhaust error. You will see an error message like this on the white screen. “Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in /home/xyz…..“. This means a plugin or theme script is exceeding the allowed memory limit. You can often fix this by increasing the memory limit. Just add the following code to your wp-config.php file. Adjust it to 64 or 96 or 128 according to your requirement.
2. Problem with plugin
Sometimes this error can happen due to some issues related to the plugins you have installed. This could be an obsolete plugin or incompatible plugin, or you tried to edit a plugin file and screwed up. When a plugin issue throws a white screen error it will lock you out. You wont be able to log in to your admin panel and deactivate the problematic plugin.
So there is a work around for this. Using FTP, access the plugins folder in the wp-content directory and rename it slightly. For example I would just change the name plugins to plug_ins . This way all the plugins on your site will be de activated and you will be able to login to your admin panel. Don’t forget to undo the name change once the plugins are deactivated. Then enable the plugins one by one and identify the plugin creating the problem and deactivate or delete it.
3. Problem with theme
Sometimes themes can bring about a white screen error on your website. You will be able to identify it more easily because the error will appear as soon as you have activated the error prone theme. Most probably it is the functions.php file in the theme that will throw the error. Here too you will not be able to just go to your theme section and change the theme once the error has appeared. So using FTP you can rename or delete the problematic theme. This will force the wordpress to load the default theme and error will disappear. Then you can fix the issues in the theme that threw the error and enable it later.
I hope I have covered some of the most common wordpress error issues and their fixes here and there are other websites like the official wordpress support forum where you can find more in depth and advanced bug fixing techniques and methods. Happy blogging..