Enable PHP error logging to a certain file you define by editing your .htaccess file

To troubleshoot, you need to tell your webserver to log PHP errors. Here’s how you can get started.

Just put this in your .htaccess file then be sure you make a “/logs” folder or some other folder and update the path to accommodate your browser.

# enable PHP error logging
php_flag  log_errors on
php_value error_log  /home/path/public_html/domain/logs/PHP_errors.log

For this to work, you will need to edit the path in the last line to reflect the actual location of your PHP_errors.log file. It is a good idea to secure the log file by adding these lines of code to your htaccess file:

# prevent access to PHP error log

 Order allow,deny
 Deny from all
 Satisfy All

Need to find out what the absolute path is to your website? Just put this PHP code and open the page in your browser:


About Author:

Senior Cloud Software Engineer and 25+ years experienced video production, video editing and 3D animation services for a variety of global clients including local video production here in Jacksonville, Florida.

Leave a Comment

Your email address will not be published. Required fields are marked *