Home Index

Welcome, Guest
Welcome, Guest. Please login or register.
June 27, 2017, 04:33:37 am
Search:  
Advanced search
WJD Forum Index  |  WestHost Related  |  .htaccess Files  |  Topic: Turn on PHP error logging per directory.
Pages: [1] |   Go Down
Print
Author Topic: Turn on PHP error logging per directory.  (Read 19305 times)
Shawn Sorrell
Administrator
Jr. Member
*****
Offline

Gender: Male
Posts: 64



WWW
« on: December 18, 2007, 07:53:09 am »

If you want to turn on error logging for a specific directory and don't want to mess with the main php.ini file you can do so by createing a .htaccess file and uploading to the directory in question.  Include in the file the following code.
Code:
php_flag log_errors on
php_value error_log /var/www/html/some_directory/php-error.log

This would create a log file called php-error.log in /var/www/html/some_directory.  You can change both the log file name and path to the directory where you want the log written. The log does not have to be written to the same directory you upload the .htaccess file to. You just need to have write access for the directory you want it written in.  Another popular choice for a directory would be where your other logs are written to.  That bit of code would look like this.

Code:
php_flag log_errors on
php_value error_log /var/log/php-error.log

Log files are created as plain text files and can be downloaded and read with free programs like EditPlus or Crimson.
Logged

Shawn Sorrell
Remember I am not an expert but a jack of all trades.  Information posted here should be used at your own risk. You are responsible for any changes you make to your account/website.
Pages: [1] |   Go Up
Print
WJD Forum Index  |  WestHost Related  |  .htaccess Files  |  Topic: Turn on PHP error logging per directory.
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC