-   Linux - Server (
-   -   Can't get Apache to log errors (

drigby 04-12-2012 05:24 PM

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!

bathory 04-13-2012 09:41 AM


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


drigby 04-13-2012 10:40 AM

Thanks. That's what I needed to know!

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

All times are GMT -5. The time now is 04:05 PM.