change error reporting via htaccess

A quick quide on how to use htaccess file (is configured in php.ini) to display or logPHP errors or change error reporting level.

To simply display errors add the following line at the top of your .htaccess file

php_flag display_errors on

To enable error loggin to a file add the line below, replacing DIR_PATH with filepath of your log file. Make sure the file is writable by your webserver.

php_flag log_errors on
php_value error_log /DIR_PATH/PHP_errors.log

The next line enables logging or displaying of all errors. You can change the integer to suite your error logging requirements. Use the tool at the following URL to calculate the error loging value: http://www.bx.com.au/tools/ultimate-php-error-reporting-wizard

php_value error_reporting 32767

You should also add the following directive to you .htaccess file if you intend to place PHP_errors.log within publicly accessible web folder. However I'd recommend placing the log file in a folder that is not accessible via a browser

<Files PHP_errors.log>
 Order allow,deny
 Deny from all
 Satisfy All
</Files>

 

Would you like to contribute?



Free business joomla templates