Thursday, February 7, 2013

Word Press White Screen of Death... Fixed!

Word Press... I have mixed emotions about Word Press. It's free, so it's hard to get upset with Word Press, and there about a gazillion plugins. However, the admin side can be a bit complicated for clients - and for developers, Word Press cans sometimes cause you great pain, like when you get the dreaded "W-SOD" (White Screen Of Death).

Well, this is how I fixed the problem on one site recently. I'm telling you this to save you the day I wasted on the problem.

BEFORE YOU STUFF AROUND WITH UPGRADING WORD PRESS, SWITCHING THEMES OR DISABLING PLUGINS - DO THIS:

If you, like me had not recently made a code change, it's highly likely to be hosting related. Now, you may not be able to get the hosting company to agree with you at first, you need proof.
  1. Check server logs, review errors and warnings.
    You should be able to get to these from Control Panel.
    Here you will see indication of the error below.
  2. Turn on error checking in your config file.
    Edit wp-config.php and change "false" to "true"
    define('WP_DEBUG', false);
  3. Now try to edit the post that shows a white screen, what do you see?
    If you see something like:
    Fatal error: Out of memory (allocated 26476544) (tried to allocate 122880 bytes)
    Then you need to:
  4. Send error to your hosting company and ask them to increase PHP memory allocation
  5. Then edit your config file again... and increase the size limit. (I made mine max of 512).
    define('WP_MEMORY_LIMIT', '16M');
  6. MAKE SURE THEY REBOOT SERVER!
Now, this fixed my issue - but it took me a day to get there, because first up I was sure it was a plugin issue after reading heaps of forum posts. I disabled plugin and it seemed to mostly work again - but as I was using Types I could not check Posts because they were not showing. With the error - I could not even check Custom Types settings. I also switched themes back and forth, changed permalinks, upgraded Word Press..... but turned out to be a simple hosting issue. DEBUG is your friend in a white out!

While you have the log files and debug turned on, check warnings and fix some of the small issues that may be kicking around too like deprecated features - will post about a few of these too.

I hope you can be lucky with a fix this simple too!