Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 07-01-2008, 07:43 PM   #1
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 448

Rep: Reputation: 34
PHP not logging via syslog-ng

Hi all,

This is on ArchLinux
fukawi2 ~ $ php --version
PHP 5.2.6 with Suhosin-Patch (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:
root ~ # grep '^error_log' /etc/php/php.ini 
error_log = syslog
root ~ #
And syslog-ng is setup as so:
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
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:
root ~ # egrep '^error_reporting |^log_errors ' /etc/php/php.ini 
error_reporting  =  E_ALL
log_errors = On
root ~ #
It actually seems to be a problem with PHP:
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....
root ~ # cat /tmp/php.log 
root ~ #

Last edited by fukawi2; 07-01-2008 at 07:44 PM.
Old 07-02-2008, 04:41 AM   #2
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,550

Rep: Reputation: 136Reputation: 136
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...
Old 07-02-2008, 04:49 AM   #3
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 448

Original Poster
Rep: Reputation: 34
Seems my test script actually never generated an error in the first place - whoops

I changed my test script to this:
echo $VAR."<br>\n";
echo "Moo<br>\n"
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!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
syslog-ng is not logging coreno Linux - Software 4 09-08-2007 01:13 PM
Using syslog-ng to for application logging nathan2225 Programming 1 05-21-2007 10:55 AM
syslog-ng and logging software gatsby Linux - Software 1 04-24-2007 11:15 AM
Logging/syslog s0n|k Linux - Newbie 2 03-13-2006 07:36 PM
syslog running but not logging tantric Linux - Security 1 10-15-2003 07:24 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration