Help answer threads with 0 replies.
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 04-12-2012, 04:24 PM   #1
LQ Newbie
Registered: Apr 2012
Location: Colorado
Distribution: CentOS
Posts: 11

Rep: Reputation: Disabled
Can't get Apache to log errors

I have been trying to get php to put its errors into a separate log file: "php_log". In php.ini I set:

error_log = /var/log/httpd/php_log
The php errors continue to show up in httpd's "error_log". I've reset apache many times since I changed the setting (I've tried other file names as well), and phpinfo() confirms all settings are the way I want them.

Here are some other settings you may or may not find relevant:
error_reporting  =  E_ALL
display_errors = Off # On on the test server (same results of coarse)
log_errors = On
log_errors_max_len = 1024
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
Thanks for the help!
Old 04-13-2012, 08:41 AM   #2
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,196

Rep: Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676Reputation: 1676

You didn't mention your distro, but I guess it's a rhel based one as it uses /var/log/httpd for logging.
Note that php writes its logs with the rights of the user running apache. In your case the apache user cannot create and write /var/log/httpd/php_log and so it keeps logging into apache error_log.
Unless you want to change the directory permissions (that is not advisable), you can change the location for the php_log to somewhere that can be written by the apache user (e.g. /tmp/php_log)
Also if you're using SELinux, check if it allows apache to write in /tmp

Old 04-13-2012, 09:40 AM   #3
LQ Newbie
Registered: Apr 2012
Location: Colorado
Distribution: CentOS
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks. That's what I needed to know!

And, yes on the rhel based... CentOS to be specific. Thanks again!

Last edited by drigby; 04-13-2012 at 09:44 AM.


apache2, centos5, logging, php5

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
(Bash) Redirect all output from script to all.log and copy of errors to err.log hmsdefender Programming 5 03-05-2010 01:52 PM
[SOLVED] Apache Don't Log 404 Errors fukawi2 Linux - Server 3 02-17-2010 12:04 AM
In Apache server, How to change log file location and log format for access log fil? since1993 Linux - Server 1 08-19-2009 04:14 PM
FX5600 Geforce - FC9 - black screen, no (EE) errors in /var/log/Xorg.0.log?? boyd98 Linux - Hardware 1 06-17-2008 08:56 PM
More Apache Log Errors! Crashed_Again Linux - General 2 02-27-2003 05:21 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:31 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