How to enable errors display and logging in hPanel
In hPanel, you have 2 options on how to see PHP errors:
For them to be displayed on the website directly
For them to be stored in the log file
In both cases, all you need to do is reach your hPanel, then open Websites → Manage, search for PHP Configuration on the sidebar and click on it:
Once there, open the PHP options section.
To make errors visible on your website directly, add a checkmark for the displayErrors (display_errors) parameter
To make errors logged in a specific file, mark logErrors (log_errors)
Make sure to save changes before leaving the page 😊
How to enable errors display in WordPress
If you are using WordPress, in the File Manager open your public_html/wp-config.php file. Check if it has this line:
define('WP_DEBUG', false);
If yes, change "false" to "true". Then, add a line:
define('WP_DEBUG_DISPLAY', true);
That's it, now PHP errors will be displayed on your WordPress website 😊
How to enable errors display via .htaccess
To start logging your PHP errors to an error_log file of your choice, add the following lines to your .htaccess file:
# log PHP errors to a file
php_flag log_errors on
php_value error_reporting 32767
php_value error_log "error_log.txt"
NOTES:
Make sure to make a backup of your previous .htaccess file before making any changes, as incorrect settings can make your website inaccessible.
These options will only display data about PHP errors, like Warning, Deprecated, Notice, etc. Errors like 503, Error establishing database connection and similar are not PHP errors, so they will not be stored in a log
Additional resources: