[CentOS] Redirecting PHP error messages into a log file

Alexander Farber

alexander.farber at gmail.com
Fri Jul 30 22:47:05 UTC 2010


Hello,

I'm using CentOS release 5.5 x86_64 with the stock php-5.1.6-27.el5
and would like to redirect PHP messages into /var/log/httpd/php_log

First I tried adding that file name to /etc/php.ini:
error_log = "/var/log/httpd/php_log"
and restarted httpd, but the file didn't appear.
I've touched it and changed owner to apache.apache,
but that didn't help.

Then I've changed that line to error_log = syslog
and now I get the messages in /var/log/messages:

Jul 29 21:29:24 hXXX httpd: PHP Notice:
    Undefined index:  REMOTE_ADDR in
/var/www/html/odnoklassniki/index.php on line 44
Jul 29 21:29:45 hXXX httpd: PHP Parse error:
    syntax error, unexpected '[' in
/var/www/html/odnoklassniki/index.php on line 44

I still would like to move those message to a separate file
though, so I've added the following line to /etc/syslog.conf
and reloaded syslogd service:

httpd.*                                                 /var/log/httpd/php_log

but the file is still empty. Any hints please?

Thank you
Alex

--
http://preferans.de



More information about the CentOS mailing list