Re: [CentOS] Redirecting PHP error messages into a log file

2011-06-29 Thread Kai Schaetzl
Alexander Farber wrote on Sat, 31 Jul 2010 00:47:05 +0200:

 First I tried adding that file name to /etc/php.ini:
 error_log = /var/log/httpd/php_log

I can assure you that you don't have to go the syslog way. Logging to a 
php errorlog file of your choice works just fine. Check the file 
permissions and check for selinux warnings.

Kai


___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Redirecting PHP error messages into a log file

2010-07-31 Thread Keith Roberts
On Sat, 31 Jul 2010, Alexander Farber wrote:

 To: CentOS mailing list centos@centos.org
 From: Alexander Farber alexander.far...@gmail.com
 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.

It's a bit tricky setting up PHP error logging to a seperate 
file. This works for me on 32bit, Centos 5.5 and Fedora 12, 
and previous Fedora versions.

Here are my settings:

SELinux disabled at boot time.

/etc/php.ini file:

; Besides displaying errors, PHP can also log errors to locations such as a 
; server-specific log, STDERR, or a location specified by the error_log
; directive found below. While errors should not be displayed on productions
; servers they should still be monitored and logging is a great way to do that.
; Default Value: Off
; Development Value: On
; Production Value: On
; 
http://www.php.net/manual/en/errorfunc.configuration.php#ini.log-errors
log_errors = ON


; Set maximum length of log_errors. In error_log information about the source is
; added. The default is 1024 and 0 allows to not apply any maximum length at 
all.
; 
http://www.php.net/manual/en/errorfunc.configuration.php#ini.log-errors-max-len
log_errors_max_len = 1024

; Do not log repeated messages. Repeated errors must occur in same file on same
; line unless ignore_repeated_source is set true.
; 
http://www.php.net/manual/en/errorfunc.configuration.php#ini.ignore-repeated-errors
ignore_repeated_errors = Off

; Ignore source of message when ignoring repeated messages. When this setting
; is On you will not log errors with repeated messages from different files or
; source lines.
; 
http://www.php.net/manual/en/errorfunc.configuration.php#ini.ignore-repeated-source
ignore_repeated_source = Off

; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log
; Log errors to syslog or specified file (Event Log on NT, not valid in Windows 
95).
;error_log = syslog
error_log = /var/log/apache/php_error_log

The file permissions for my php error log are:

[r...@karsites apache]# ls -l php*
-rw-rw-rw- 1 root root 91472 2010-07-31 08:00 php_error_log
-rw-rw-rw- 1 root root 0 2008-05-29 13:30 php_error_log.skel
-rw-rw-rw- 1 root root 0 2008-05-29 13:30 php_mail_log
[r...@karsites apache]#

If the PHP error log file is not set up correctly, then PHP 
will just output the errors to the apache error log file 
instead.

HTH

Keith Roberts
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Redirecting PHP error messages into a log file

2010-07-31 Thread Christoph Maser
Am 31.07.2010 14:48, schrieb Keith Roberts:

 It's a bit tricky setting up PHP error logging to a seperate
 file. This works for me on 32bit, Centos 5.5 and Fedora 12,
 and previous Fedora versions.

 Here are my settings:

 SELinux disabled at boot time.

How about leaving it on and consult /var/log/audit/audit.log to see if 
selinux is interfering. I guess if there is any denial its just because 
your new logfile has the wrong context and you can easily change that 
with chcon.

+C
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Redirecting PHP error messages into a log file

2010-07-30 Thread Jason Pyeron
 

 -Original Message-
 From: centos-boun...@centos.org 
 [mailto:centos-boun...@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@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 x333Baltimore, Maryland 21218   -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.


___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Redirecting PHP error messages into a log file

2010-07-30 Thread Alexander Farber
So you think the httpd.* line in syslog.conf is correct?

On Sat, Jul 31, 2010 at 12:48 AM, Jason Pyeron jpye...@pdinc.us wrote:
 -Original Message-
 I still would like to move those messages 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?

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Redirecting PHP error messages into a log file

2010-07-30 Thread John R. Dennison
On Sat, Jul 31, 2010 at 12:57:07AM +0200, Alexander Farber wrote:
 So you think the httpd.* line in syslog.conf is correct?

No, it's incorrect.

Syslog filters based on facility and priority.  httpd is not
a known facility.  man 5 syslog.conf will list the available
facilities.  I see no quick reference to what facility php
is using, but if I had to hazard a guess I'd say it was
daemon; the priority remains in question, though.

Due to potential for DOS I'd not use syslog for this, however;
I would use error_log pointing to an accessible path, making
whatever selinux changes may be required.




John


-- 
You can safely assume you've created God in your own image when it turns
out that God hates all the same people you do.

-- Anne Lamott (10 April 1954-), American author, Bird by Bird


pgpICRL6qn9Mb.pgp
Description: PGP signature
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos