From:             mfoxx at hotmail dot com
Operating system: Debian 3.x
PHP version:      5.0.3
PHP Bug Type:     PHP options/info functions
Bug description:  error_log not able to be overridden...

Description:
------------
FYI:  I am running a server where I built from source the apache and PHP
binaries, so I am not susceptible to the problems other bugs reported
where they might have used a pre-packaged binary with some other
unexplained behavior.

If I set a value for error_log in my php.ini (to /home/php.errors, for
instance), PHP correctly logs any errors encountered (in ANY of my
<virtualhost> sites) there to that single file.

However, when I do in a script (because error_log is said in the manual to
be modifiable as PHP_INI_ALL, which means i can change it anywhere):

ini_set("error_log","/path/to/some.log.file");

or when I do:

php_value error_log "/path/to/some.log.file"

in my httpd.conf inside a <virtualhost>, or my .htaccess file for a
particular site, the VALUE is apparently "changed", but PHP doesn't seem
to respect it, when coming across an error later in code.  Furthermore,
PHP will not even write the errors to the original error_log value set
before in the php.ini.  It will instead write them to apache's error log
for that particular <virtualhost>.

As you can see in my "reproduce code" i change the error_log variable
using ini_set(), then i do phpinfo(), and verify that it DOES IN FACT have
the new changed value in its output, overriding the default that I set in
my php.ini file.  And then I call a function which doesn't exist, which
should force a PHP error.

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

ini_set("error_log","/path/to/php.err");

phpinfo();

echo nonexistent();

?>

Expected result:
----------------
I expected for the value of error_log to be changed, so that when I force
a PHP error, calling a "nonexistent()" function, I should get the error
logged into my php.err file as specified in ini.set.

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.

But, as I stated before, if I just set the value in php.ini, and DON'T try
to modify it in code (or httpd.conf), then the error gets logged to the
location I specified in php.ini.

So, basically, when you try to modify the error_log setting at runtime, it
irreversibly starts the PHP error logging to the Apache error log, no
matter what you specify.

-- 
Edit bug report at http://bugs.php.net/?id=31419&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31419&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31419&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31419&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31419&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31419&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31419&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31419&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31419&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31419&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31419&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31419&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31419&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31419&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31419&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31419&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31419&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31419&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31419&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31419&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31419&r=mysqlcfg

Reply via email to