#31419 [Com]: error_log not able to be overridden...

From: Date: Wed, 06 Aug 2008 13:58:39 +0000
Subject: #31419 [Com]: error_log not able to be overridden...
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127662@lists.php.net to get a copy of this message
ID: 31419 Comment by: alexey dot portnov at gmail dot com Reported By: mfoxx at hotmail dot com Status: No Feedback Bug Type: PHP options/info functions Operating System: Debian 3.0 PHP Version: 5.0.4 New Comment: Description: ------------ FreeBSD 6.2-RELEASE apache 2.2.9, php-5.2.6, (from ports) php.ini config: /usr/local/etc/php.ini error_log = /home/sites/php_logs/php_errors.log PHP will not even write the errors to the original error_log value set in the php.ini. It will instead write them to apache's error log for that particular <virtualhost>. The error does occur, and it DOES get logged, just not to the right file, it now gets logged to the APACHE error log file, not even the original php.ini error_log setting, which I find very strange. Reproduce code: --------------- <?php phpinfo(); echo nonexistent(); ?> Expected result: ---------------- When I force a PHP error, calling a "nonexistent()" function, I should get the error logged into my /home/sites/php_logs/php_errors.log file as specified in /usr/local/etc/php.ini Actual result: -------------- the error (call to undefined function) DOES get logged, but to the wrong file... it gets logged to the Apache error file for that particular <virtualhost>. It doesn't even get logged to the original php.ini file's setting for error_log. PHP writes errors in $error_log only when I run scripts from CLI: php /path-to/script.php Previous Comments: ------------------------------------------------------------------------ [2005-07-26 01:00:04] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2005-07-18 19:26:03] sniper@php.net Using latest CVS snapshot (5.1-dev) this works just fine, provided the path passed to error_log is such that the webserver can write into it. And I don't get any PHP errors in the apache logs either. Check the permissions. And if that wasn't the cause, check what php.ini file is used (shown in phpinfo() output) and do a 'diff -u' between that and php.ini-dist from the latest CVS snapshot you're using. ------------------------------------------------------------------------ [2005-07-18 18:52:09] mfoxx at hotmail dot com Also, here is the VirutalHost directive from httpd.conf: <VirtualHost xxx.xxx.xxx.xxx> ServerAdmin xxx@xxx.com DocumentRoot /www/xxx ServerName www.xxx.com ErrorLog /www/logs/xxx_com-error.log CustomLog /www/logs/xxx_com-access.log common </VirtualHost> The apache error log I keep referring to, that is getting the PHP errors logged to it, is the one specified above at "ErrorLog", xxx_com-error.log. ------------------------------------------------------------------------ [2005-07-18 18:46:41] mfoxx at hotmail dot com I just upgraded to the latest Apache 2.0.54, and PHP 5.0.4, and again, I am still having the same problem. I go into my php.ini file, and I comment out the setting for the php error_log. I then create a script like this: <?php ini_set("error_log","/path/to/logs/php-err.txt"); phpinfo(); nonexistent(); ?> When I examine the output of phpinfo(), i see the value set in the ini_set() call. However, the error that occurs when I call the nonexistent() function does NOT get logged to that file (nor does the file even get created). It however does get logged to the virtual-host specific apache error log (error.log) that is set to be in the same directory. I even tried creating an empty file (thinking maybe it was the creation of the file that wasn't working) in the logs directory, and then restarting apache. Reran the script, and still, the error gets logged to the apache log for that virtual-host, not to the value set by ini_set(). ------------------------------------------------------------------------ [2005-02-28 23:24:39] mfoxx at hotmail dot com I just installed the new CVS snapshot of this, and I am now seeing a different behavior, but still not the correct one. Now, no matter whether I specify an error_log in php.ini or not, ALL php errors are going to the each virtual-host specific apache error log. I can't override it with a valid error_log setting in php.ini, nor can I override it in code, as my original bug report submitted that I had tried. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31419 -- Edit this bug report at http://bugs.php.net/?id=31419&edit=1

« previous php.bugs (#127662) next »