Enable PHP Error logging using htaccess

  • Avinash
  • 2
  • May 02, 2011
  • Web Development

Normally error reporting and display errors are set to off on productstion mode, so its hard for developers to find the error which are occurring.

So we can set the PHP.ini values using htaccess also, Below are some rules which can be defined in htaccess file and it will log the all php errors for review.

####### PHP DEBUGGING RULES ####### # supress display of php errors, Below three lines will disable the PHP error reporting to user php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off # enable verbose PHP error logging to a file, Below three lines will log the all PHP error, warning and notices in log files at the path specified. php_flag log_errors on php_value error_reporting 2047 php_value error_log /home/domain.com/php.error.log ####### END PHP DEBUGGING RULES #######
####### PHP DEBUGGING RULES #######
# supress display of php errors, Below three lines will disable the PHP error reporting to user
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off

# enable verbose PHP error logging to a file, Below three lines will log the all PHP error, warning and notices in log files at the path specified.
php_flag  log_errors on
php_value error_reporting 2047
php_value error_log  /home/domain.com/php.error.log
####### END PHP DEBUGGING RULES #######

Hope you find this trick helpful. Let us know your suggestion/comments on this.

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: