LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   PHP not logging via syslog-ng (https://www.linuxquestions.org/questions/linux-server-73/php-not-logging-via-syslog-ng-652935/)

fukawi2 07-01-2008 07:43 PM

PHP not logging via syslog-ng
 
Hi all,

This is on ArchLinux
Quote:

fukawi2 ~ $ php --version
PHP 5.2.6 with Suhosin-Patch 0.9.6.2 (cli) (built: May 1 2008 21:14:36)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

fukawi2 ~ $ syslog-ng --version
syslog-ng 2.0.9

Having a problem with PHP on Apache and not being able to get logs out. My php.ini is logging to syslog:
Code:

root ~ # grep '^error_log' /etc/php/php.ini
error_log = syslog
root ~ #

And syslog-ng is setup as so:
Code:

root ~ # grep php /etc/syslog-ng.conf
destination php                { file("/var/log/php.log"); };
filter f_php                { program("^php"); };
log { source(src); filter(f_php);        destination(php); };
root ~ #

I've also tried replacing program("^php"); with match("php"); but to no avail :(

I have a test page on my webserver which should throw an error:
root ~ # cat /home/fukawi2/public_html/test.php
Code:

<?php
echo "Moo"
?>

(No ; to end the echo statement)
When I access this page via my web browser, it prints "Moo", but no error is written to /var/log/php.log

PHP is setup to log everything:
Code:

root ~ # egrep '^error_reporting |^log_errors ' /etc/php/php.ini
error_reporting  =  E_ALL
log_errors = On
root ~ #

EDIT:
It actually seems to be a problem with PHP:
Code:

root ~ # grep "^error_log" /etc/php/php.ini
error_log = /tmp/php.log
root ~ # touch /tmp/php.log
root ~ # chmod 777 /tmp/php.log
root ~ # /etc/rc.d/httpd restart
:: Stopping HTTP Daemon                [DONE]
:: Starting HTTP Daemon                [DONE]
root ~ #

I then accessed my test error page, but....
Code:

root ~ # cat /tmp/php.log
root ~ #


j-ray 07-02-2008 04:41 AM

1.
is there a second php installation or at least a second php.ini on board, maybe? So the one in /etc/php is not used in your case?

2. add another line to your test script. The missing ";" will cause an error in the next line, but not if standing alone...

fukawi2 07-02-2008 04:49 AM

Seems my test script actually never generated an error in the first place - whoops :o

I changed my test script to this:
Code:

<?php
$VAR=1
echo $VAR."<br>\n";
echo "Moo<br>\n"
$VAR=$VAR+1;
echo $VAR
?>

And now I get errors... Just need to figure out the syslog-ng configuration now. I'll give that a shot later, have to shoot out now.

Thanks j-ray! :D


All times are GMT -5. The time now is 11:39 PM.