Finding PHP error logs and showing or hiding errors
Ce contenu n’est pas encore disponible dans votre langue.
When a PHP site shows a blank page, a 500 error or “There has been a critical error on this website”, the PHP error log usually tells you why.
Where to find PHP error logs
Section titled “Where to find PHP error logs”PHP error logging is on by default. PHP writes errors to a file called error_log in the same folder as the script that failed, for example:
public_html/error_logfor your main websitepublic_html/wp-admin/error_logfor errors in the WordPress dashboardpublic_html/yourotherdomain.com/error_logfor an addon domain
To read it:
- In cPanel, open File Manager and go to your website’s folder.
- Open
error_logwith View or Edit. The newest errors are at the bottom.
Each line shows the date, the type of error, the message, and the file and line number, for example:
[15-Oct-2026 09:12:44 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mb_strlen() in /home/cpuser/public_html/wp-content/plugins/example/file.php:42The file path tells you which plugin, theme or script caused the error. See Common PHP errors for what the messages mean.
error_log files can grow large and use your disk space. Once you’ve fixed the problem, it’s safe to delete them. PHP creates a new one when the next error happens.
Show errors on the page while you fix a problem
Section titled “Show errors on the page while you fix a problem”By default, errors aren’t shown to visitors. This keeps file paths and other details private. To see errors on the page while you work:
- In cPanel, open Select PHP Version → Options.
- Set
display_errorsto On. - Reload the page that has the problem.
- Set
display_errorsback to Off when you’re done.
For one folder only, add php_flag display_errors On to that folder’s .htaccess file. See Custom PHP settings for one folder.
WordPress debug mode
Section titled “WordPress debug mode”In WordPress, the safest way is to log errors to a file without showing them to visitors. Add these lines to wp-config.php above /* That's all, stop editing! */:
define( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'WP_DEBUG_DISPLAY', false );Errors are then saved in wp-content/debug.log. Set WP_DEBUG back to false when you’re done.
Choose which errors are reported
Section titled “Choose which errors are reported”error_reporting in Select PHP Version → Options controls which errors PHP reports. The default reports all errors except “deprecated” notices, which warn about code that will stop working in a future PHP version. Choose E_ALL to see those too, for example before upgrading PHP.
Turn off error logging
Section titled “Turn off error logging”You can set log_errors to Off in Select PHP Version → Options, but we don’t recommend it: without a log, problems are much harder to find. It’s better to fix the errors filling the log.
Related articles
Section titled “Related articles”Cette page vous a-t-elle aidé ?
Merci pour votre retour.