Better error messages upon critical errors – HTTP Error 500

WordPress 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 );

You can also extend the information in the log using 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