define('WP_DEBUG', true); not show errors

2019-02-13 15:32发布

问题:

I enabled the errors in my wp-config file:

define('WP_DEBUG', true);

But this not work, Wordpress continues showing me a white screen, a blank screen with no information.

How can I solve this?

回答1:

The below code, inserted in your wp-config.php file, will log all errors, notices, and warnings to a file called debug.log in the wp-content directory. It will also hide the errors so they do not interrupt page generation.

this code you must have to insert BEFORE /* That's all, stop editing! Happy blogging. */ in the wp-config.php file.

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

// Disable display of errors and warnings 
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define('SCRIPT_DEBUG', true);

sorce: https://codex.wordpress.org/Debugging_in_WordPress



回答2:

Add these two lines below the

define('WP_DEBUG', true);

error_reporting(E_ALL);
ini_set('display_errors', 1);

then delete them when you don't need them any more.



回答3:

You can write this into your .htaccess file.

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag  log_errors on
php_value error_log  /home/path/public_html/domain/PHP_errors.log

Please change the error_log directory.



标签: php wordpress