From:             php at nearlyfreespeech dot net
Operating system: Any
PHP version:      5.3.21
Package:          Apache2 related
Bug Type:         Bug
Bug description:Setting error_log from .htaccess can leak between sites

Description:
------------
Using mod_php5 under Apache 2.2.x, if the PHP error_log value is set from 
.htaccess in two separate virtual hosts then under at least some 
conditions, the setting leaks between the virtual hosts.

For example, if an Apache server is configured with two virtual hosts,
site1 and 
site2, and site1 has an .htaccess file in its document root containing:

php_value error_log /sites/site1/logs/php_errors.log

And site2 has an .htaccess file in its document root containing:

php_value error_log /sites/site2/logs/php_errors.log

Then under at least some conditions, site2 (uid 10002) will attempt to log

errors to site1's (uid 10001) specified file.  If safe_mode is enabled,
this 
will fail, causing the following to be written to site1's file:

[Sun Feb 03 12:00:00 2013] [error] [client 10.20.40.80] PHP Warning: 
Unknown: 
SAFE MODE Restriction in effect.  The script whose uid/gid is 10002/10002
is not 
allowed to access /sites/site1/logs/php_errors.log owned by uid/gid
10001/10001 
in Unknown on line 0

Note this error is formatted by *Apache* appearing in the *PHP* error log. 
If 
it were coming straight from PHP, it would be in the format:

[03-Feb-2013 12:00:00 UTC] PHP Warning:  Unknown: 
SAFE MODE Restriction in effect.  The script whose uid/gid is 10002/10002
is not 
allowed to access /sites/site1/logs/php_errors.log owned by uid/gid
10001/10001 
in Unknown on line 0

That may help narrow down where the problem is, since it is infuriatingly 
intermittent.



Expected result:
----------------
Errors from each site should only appear in that site's specified error_log
file.



Actual result:
--------------
Errors are occasionally written to the wrong site's log file.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=64138&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64138&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64138&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64138&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64138&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64138&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64138&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64138&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64138&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64138&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64138&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64138&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64138&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64138&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64138&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64138&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64138&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64138&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64138&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64138&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64138&r=mysqlcfg

Reply via email to