Enable PHP Error Logging in cPanel Print

  • cpanel error, php error
  • 69

By default errors are set to error_log is set to /dev/null which means, it won't have error logging on. When errors are turned on will be stored in the directory the error occurs in. For example, if you have a PHP file called index.php in a subdirectory like public_html/wordpress, if you have any PHP errors in the index.php file of that location, the error log will be stored in that folder. You can specify in the php.ini what file to store all errors in.

Note:You can place the following code in the .htaccess to make the local php.ini work for the current directory where the .htaccess resides and all subdirectories beyond.

 <IfModule mod_suphp.c>

suPHP_ConfigPath /home/USERNAME/public_html


The IfModule makes Apache load the directive only if suPHP is used, so the site doesn't break if switched to another PHP handler such as DSO.

For more information on suPHP please see our article on Choosing the best PHP handler.

  1. Login into your cPanel.
  2. Go to the File Manager. Select the public_html directory and click Go.
  3. You can set the following line of code to On to log errors or off to turn error logging off.

log_errors = On

  1. Next you can save errors from any page in your files to a specific location the error_log for all your to a specific path on the server or leave the log.

This will place the error_log in the directory the error occurs in

; Log errors to specified file.

error_log = error_log

This s will place all errors in the error log inside the public_html

; Log errors to specified file.

error_log = /home/username/public_html/error_log

Now your errors will all be stored in the error_log in the public_html.

Was this answer helpful?

« Back