admin管理员组文章数量:1327980
After introduction of WP_DISABLE_FATAL_ERROR_HANDLER
I'm confused with existing WP_DEBUG
feature.
Now what's the difference here?
I mean what constant I should use to see the error if I use WP_DISABLE_FATAL_ERROR_HANDLER
then what's the meaning of WP_DEBUG
now?
Even though I went through some of tickets on WordPress but I can't figure out the use of WP_DEBUG
now.
Did WordPress ends the use of WP_DEBUG
?
After introduction of new constant WP_DISABLE_FATAL_ERROR_HANDLER
I'm not able to see errors anymore with define("WP_DEBUG",true)
.
I know about display_errors
setting in php.ini so not expecting this solution :)
After introduction of WP_DISABLE_FATAL_ERROR_HANDLER
I'm confused with existing WP_DEBUG
feature.
Now what's the difference here?
I mean what constant I should use to see the error if I use WP_DISABLE_FATAL_ERROR_HANDLER
then what's the meaning of WP_DEBUG
now?
Even though I went through some of tickets on WordPress but I can't figure out the use of WP_DEBUG
now.
Did WordPress ends the use of WP_DEBUG
?
After introduction of new constant WP_DISABLE_FATAL_ERROR_HANDLER
I'm not able to see errors anymore with define("WP_DEBUG",true)
.
I know about display_errors
setting in php.ini so not expecting this solution :)
2 Answers
Reset to default 7Those constants do different things.
- The
WP_DISABLE_FATAL_ERROR_HANDLER
constant is for disabling the new fatal error recovery feature introduced in WordPress 5.2. This new feature ensures that fatal errors from plugins don't lock you out of your site, and that front-end users get some kind of "technical difficulties" message, rather than a white screen. - The
WP_DEBUG
constant is to enable a debug mode that displays all PHP error messages and warnings on the front-end, as well as WordPress specific messages such as deprecation notices.
So you can see that they are not really related. The fatal error recovery functionality is intended to be used in production, so that white screens and PHP error messages are not displayed to users. While debug mode is intended to be used in a development environment to debug issues when developing a theme or plugin.
In a production environment (so a live site), neither constant should be enabled. Fatal error recovery should be enabled, and debug mode should be disabled.
In a development environment, you probably don't need fatal error recovery, and you'll likely want debug mode to be enabled.
If for some reason you need to debug issues on a live site, then debug mode might need to be enabled, but in that case you should have WP_DEBUG_DISPLAY
set to false
, and WP_DEBUG_LOG
set to true
, so that you can debug error messages from a log file, rather than exposing them to users.
So in a development environment you probably want:
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
define( 'WP_DEBUG', true );
And in a production environment you probably want (these would be the same as not manually defining them):
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', false );
define( 'WP_DEBUG', false );
And if you need to debug a live site you could use:
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', false );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
Very detailed answer by Jacob Peattie and I would +1 that for sure. I'd also like to add that you can use the following ini_set commands and also specify your debug log location.
@ini_set('log_errors','On'); // This is essentialy what ('WP_DEBUG', true) does.
@ini_set('display_errors','Off'); // Avoid the ugly display of errors on live sites.
@ini_set('error_log','/home/domain/logs/php_error.log'); // Set your log path.
本文标签: WPDISABLEFATALERRORHANDLER vs WPDEBUGWhat to use and when to use to see errors
版权声明:本文标题:WP_DISABLE_FATAL_ERROR_HANDLER vs WP_DEBUG ? What to use and when to use to see errors? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742250138a2440597.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论