admin管理员组文章数量:1312699
I had an error in a custom class I've made, where this was the error:
private function someFunction(): void { // Returns void
...
...
...
return true; // <- Returns a value, when the function is set to void
}
In my wp-config.php
I have these lines added:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 1 );
If I add this: define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
to my wp-config.php
-file, then I get a HTTP ERROR 500.
But I still got an the message:
There has been a critical error on this website.
How do I get better error messages for situations like these?
I mean... How difficult can it be to tell me where an error like this is in the code. #firstworldproblems
I had an error in a custom class I've made, where this was the error:
private function someFunction(): void { // Returns void
...
...
...
return true; // <- Returns a value, when the function is set to void
}
In my wp-config.php
I have these lines added:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 1 );
If I add this: define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
to my wp-config.php
-file, then I get a HTTP ERROR 500.
But I still got an the message:
There has been a critical error on this website.
How do I get better error messages for situations like these?
I mean... How difficult can it be to tell me where an error like this is in the code. #firstworldproblems
Share Improve this question asked Dec 30, 2020 at 19:34 ZethZeth 9282 gold badges13 silver badges43 bronze badges1 Answer
Reset to default 1WordPress error handling is pretty good, but you do need to do a little work to shape this to your needs:
I can tell you that the most simple set-up I know is to log errors to the wp-content/debug.log file - using the following set-up in wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
You can also extend the information in the log using xdebug - https://xdebug/ - but it's not essential.
This should give you type, line and reason for all PHP error, like:
[30-Dec-2020 19:54:39 UTC] PHP Parse error: syntax error, unexpected 'an' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in C:\xampp\htdocs\file.php on line 10
本文标签: wp configBetter error messages upon critical errorsHTTP Error 500
版权声明:本文标题:wp config - Better error messages upon critical errors - HTTP Error 500 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741879107a2402641.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论