#35301 [Bgs]: open_basedir allows one file in dir but not others further in
| From: | bgshea at gmail dot com | Date: | Sun, 20 Nov 2005 16:41:03 +0000 |
| Subject: | #35301 [Bgs]: open_basedir allows one file in dir but not others further in | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-88580@lists.php.net to get a copy of this message | ||
ID: 35301
User updated by: bgshea at gmail dot com
Reported By: bgshea at gmail dot com
Status: Bogus
Bug Type: Safe Mode/open_basedir
Operating System: Linux 2.6
PHP Version: 5.0.5
New Comment:
Indeed, you are correct, the fact that 0.inc does not exist in the dir
causes the failure, the bug seems to be in the documentation on how to
use open_basedir.
I overlooked a previous bug report (Bug #30188).
For all that read these bugs, you need to check for file existance
(file_exists(/path/to/file) ).
Maybe the open_basedir should be called something else cause it is
mis-leading if it also dis-allows on a file by file basis.
I'm gonna post this in the docs as well.
Thanks for the little bit help.
Previous Comments:
------------------------------------------------------------------------
[2005-11-20 10:14:03] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2005-11-20 08:46:47] bgshea at gmail dot com
Description:
------------
[Sun Nov 20 00:36:12 2005] [error] [client 68.35.85.123] PHP Warning:
readfile() [<a href='function.readfile'>function.readfile</a\
>]: open_basedir restriction in effect.
File(/home/bgshea/g2data/cache/module/core/0/0/0.inc) is not within the
allowed path(s): (/\
mnt/sdc1/pub/www/:/usr/local/php-5.0.5/lib/:/mnt/sdc1/home/:/mnt/sdc1/pub/webfiles/)
in /mnt/sdc1/home/bgshea/webpage/fopen.php on \
line 12, referer: http://www.hackthebox.org/~bgshea/
NOTE: /home is a symlink to /mnt/sdc1/home
This is my first bug report, so if this does not post right, I'm sorry.
BTW: I've spent 5 hours trying to fix this, looked at all bugs related
to open_basedir and could not figure this out.
Reproduce code:
---------------
//Test a file open under /home/ works
$file=fopen("/home/bgshea/webpage/info.php", "r" );
fclose( $file );
//test a file read under /home/bgshea/g2data, works
readfile( "/home/bgshea/g2data/install.log" );
//This should work, but fails. Why? no symlinks here.
readfile("/home/bgshea/g2data/cache/module/core/0/0/0.inc");
open_basedir was set in httpd.conf to be
/mnt/sdc1/pub/www/:/usr/local/php-5.0.5/lib/:/mnt/sdc1/home/:/mnt/sdc1/pub/webfiles/
Expected result:
----------------
/home/bgshea/g2data/cache/module/core/0/0/0.inc file should be opened
Actual result:
--------------
Error message reported in log file, php script is terminated
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35301&edit=1