FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 07-30-2010, 11:17 PM
"John R. Dennison"
 
Default Redirecting PHP error messages into a log file

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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2010, 12:48 PM
Keith Roberts
 
Default Redirecting PHP error messages into a log file

On Sat, 31 Jul 2010, Alexander Farber wrote:

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

[root@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
[root@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
 
Old 07-31-2010, 01:09 PM
Christoph Maser
 
Default Redirecting PHP error messages into a log file

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
 
Old 06-29-2011, 10:01 PM
Kai Schaetzl
 
Default Redirecting PHP error messages into a log file

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
 

Thread Tools




All times are GMT. The time now is 07:45 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org