php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19395 open_basedir (closing slash does not work)
Submitted: 2002-09-13 12:05 UTC Modified: 2005-01-31 22:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: benter at yippi-yeah dot com Assigned:
Status: Closed Package: Safe Mode/open_basedir
PHP Version: 4.2.3 OS: Linux 2.4.16-4GB (SuSE kernel)
Private report: No CVE-ID: None
 [2002-09-13 12:05 UTC] benter at yippi-yeah dot com
In   
http://www.php.net/manual/en/printwn/configuration.php#ini.open-basedir   
it says:   
   
When you want to restrict access to only the specified   
directory, end with a slash. For example: "open_basedir =   
/dir/incl/"    
  
We have three test webs:  
  
/home/www/www1  
/home/www/www4  
/home/www/www102  
  
Each web has it's own virtual host and open_basedir set to  
it's directory:  
  
For www1 phpinfo() says:  
safe_mode: On  
open_basedir: /home/www/www1/ (<- closing slash!)  
  
With test.php in /home/www/www1/html/  
  
<?  
 $parent = dir('/home/www/www102/html');  
?>  
  
I get:  
  
Warning: SAFE MODE Restriction in effect. ...  
  
Changing it to read www4's dir:  
  
<?  
 $parent = dir('/home/www/www4/html');  
?>  
  
I get:  
  
Warning: open_basedir restriction in effect. File is in  
wrong directory ...  
  
So, the closing slash does not prevent www1's scripts  
accessing www1* scripts via open_basedir. With safe_mode 
deactivated www1 could read www1*'s dirs but not 
www4,www5,www6... dirs. Either the documentation is wrong 
or the slash at the end is ignored? 
  
Regards,  
  
Jan-Hendrik Benter  

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-22 13:35 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jan 25 04:01:24 2020 UTC