|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12683 Safe mode (apache with mod_perl) uses incorrect uid
Submitted: 2001-08-09 20:49 UTC Modified: 2002-06-01 11:53 UTC
From: jfisher at deas dot harvard dot edu Assigned:
Status: Not a bug Package: Apache related
PHP Version: 4.0.6 OS: Solaris 5.8
Private report: No CVE-ID: None
 [2001-08-09 20:49 UTC] jfisher at deas dot harvard dot edu
In PHP 4.0.6 (and 4.0.5) using apache with mod_perl and php4 compiled in (statically), safe mode denies access to all files, believing that it is running as UID 1 [basically this is like bug # 7744 ].

Recompiling apache and leaving out mod perl, allows the php pages to be accessed with safe mode. Not running with safe mode while mod_perl is compiled in, allows the php pages to be accessed. Only when mod_perl is compiled in and safe mode is running does every single page (even a simple phpinfo() or something with a single print() ) returns the following (this was a request for "/test.php"):

[08-Aug-2001 13:00:11] PHP Warning:  SAFE MODE Restriction in effect.  The script whose uid is 1 is not allowed to access /var/htdocs/test.php owned by uid 0 in Unknown on line 0
[08-Aug-2001 13:00:11] PHP Warning:  Failed opening '/var/htdocs/test.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0

Granted root owns it in the above example, but it does not matter if the uid is that of me, the webserver, or someone else. Note that the original request is for test.php. As no includes, system calls, etc... are done in test.php, it should work regardless of who actually owns that file.

It seems to be looking for an owner uid of 1. I tried putting some printf's in the code and it seems that the stat struct that is returned from sapi_get_stat() - I think the one directly from the apache "request" object - is messed up. It always has a uid of 1, a size of 0, and a inode of 0.

Mod perl is before php in the activate-modules directives given when building apache, and it shows up above php when running "httpd -l". If I didn't know any better, I'd think this was a perl bug, but it is php that isn't working.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-01 11:53 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 18:01:35 2024 UTC