Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on a small plugin and on some WP installations it throws up the white screen of death.

I'm new to this, and would like to know if there is a decent guide out to there (so far my googling over the white screen of death hasn't turned up anything for developers), or some best practices I should be following to make sure I catch errors or avoid anything foolish.

Any and all links or tips would be massively appreciated.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

A white screen of death is typically a fatal PHP error, most of the time due to a syntax error. This often sends no errors to the browser.

Some things you can do:

Turn on PHP error_log in your php.ini file and set the error_reporting levels. http://php.net/manual/en/errorfunc.configuration.php

Error info: http://www.php.net/manual/en/errorfunc.constants.php

Alternatively or in combination you can turn this on in your wp-config as well (from wordpress codex). http://codex.wordpress.org/Editing_wp-config.php

/**
 * This will log all errors notices and warnings to a file called debug.log in
 * wp-content only when WP_DEBUG is true
 */

define('WP_DEBUG', true); // false
if (WP_DEBUG) {
  define('WP_DEBUG_LOG', true);
  define('WP_DEBUG_DISPLAY', false);
  @ini_set('display_errors',0);
}

Turn on WordPress debugging and saved queries, (wp debug is same as above example) in your wp-config.php.

define('WP_DEBUG', true);
define('SAVEQUERIES', true);

And install the debug bar, http://wordpress.org/extend/plugins/debug-bar/

I also recommend using something like xDebug,

share|improve this answer
    
Thanks. That's a great start. I'd never run across the WSOD before so this should get me on the right track to writing some more robust code! –  josh Dec 20 '11 at 18:47
1  
Can't believe I didn't know about the debug bar. Very handy. –  josh Dec 21 '11 at 11:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.