[CentOS] Redirecting PHP error messages into a log file

Fri Jul 30 22:48:16 UTC 2010
Jason Pyeron <jpyeron at pdinc.us>

 

> -----Original Message-----
> From: centos-bounces at centos.org 
> [mailto:centos-bounces at centos.org] On Behalf Of Alexander Farber
> Sent: Friday, July 30, 2010 18:47
> To: CentOS mailing list
> Subject: [CentOS] Redirecting PHP error messages into a log file
> 
> 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?

Selinux issue?

> 
> Thank you
> Alex
> 
> --
> http://preferans.de
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
> 



--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.