Troubleshooting
Enable PHP error logging from the .htaccess file
By default, PHP error display is disabled and it must stay that way in production. Showing errors to visitors can reveal paths, queries and configuration details; reproduce the failure on staging whenever possible.
The usual procedure at Hostsuar is to temporarily enable log_errors for the effective version from Select PHP Version. If you need to limit the configuration to a directory tree and have checked that the handler supports PHP directives in .htaccess, log errors to a private file outside public_html:
php_flag display_errors Off php_flag log_errors On php_value error_log /home/CPANEL_USUARIO/logs/php-debug.log
Replace CPANEL_USUARIO, create the directory beforehand and protect the log with 0600 permissions. Run only the failing operation and check the log, without enabling on-screen error output.
When the test is over, you must remove the added directives, confirm that display_errors is still Off and delete the log once it is no longer needed. If a 500 error appears after adding them, remove them and check the site's error log. Only a message identifying php_flag or php_value as an invalid or disallowed directive confirms that the handler does not support them; the 500 error alone does not identify the cause.
If the log is still empty
Confirm that the PHP process can write to the private directory and that you are checking the configuration of the affected website, not another PHP version or the CLI. log_errors does not enable every level on its own: error_reporting decides which are logged and the application may change it.
Keep the previous values so you can restore them. If you need to widen the levels, do it temporarily in the configuration supported by that handler and reproduce a single operation; do not fill the disk by logging notices from every visit. An empty log may also mean that the failure happens before PHP or in another service.
You may also find useful
- Debug errors in PHP applications or files Diagnose a blank screen or a 500 error by reproducing the failure and checking the most specific log...
- Log PHP errors for a specific file Capture errors from a single PHP file in a private, temporary log, keeping display_errors off so det...
- Xdebug for debugging remote PHP code Set up a remote Xdebug 3 session with a private trigger and a reverse SSH tunnel, without exposing t...
- auto_prepend_file and auto_append_file Trace the request that reinfects an application by using auto_prepend_file to log only selected meta...
Something wrong or out of date? Tell us and we will review it.