Tuesday, 12 September 2017

PHP error logging does not work via .htaccess



I need to have all PHP errors logged to a file on my centOS box. I think I'm doing everything I'm supposed to. Here's my .htaccess file:




php_flag display_errors off
php_flag log_errors On
php_flag error_log /var/www/vhosts/hostname/logs/fo_errors.log




  • In my php.ini, I have error_reporting=E_ALL set.

  • Apache does parse .htaccess

  • /var/www/vhosts/hostname/logs/fo_errors.log has owner set to apache:apache and has write permissions.



I'm out of ideas.. can anyone help?



Thanks


Answer




You probably want to use php_value not php_flag when you set the log path. php_flag is only used for setting boolean configuration properties.



php_flag display_errors off 
php_flag log_errors On
php_value error_log /var/www/vhosts/hostname/logs/fo_errors.log

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...