Do you have a question? Post it now! No Registration Necessary. Now with pictures!
June 24, 2006, 9:40 pm
rate this thread
I use php 5.1.4 with apache 2.2.2 on Solaris 10.
The problem is that I can't configure open_basedir
because I always get warming message:
Warning: readfile() [function.readfile]: open_basedir restriction in
effect. File(test.txt) is not within the allowed path(s):
(/wwwroot/default) in /wwwroot/default/mk.php on line 3
Warning: readfile(test.txt) [function.readfile]: failed to open stream:
Not owner in /wwwroot/default/mk.php on line 3
open_basedir = /wwwroot/default
- test.txt <- my txt file
- mk.php <- my script that read test.txt
My read file - test.txt is in open_basedir path.
When I use full path to the file everything is ok.
Do you have any clue ?
Image the following situation:
The text and script files are in the following dir:
The script file includes the text file relatively to the current working
dir, as in:
The open_basedir directive is set as follows:
open_basedir = /somedir/subdir
Now, you cd to /somedir/subdir and execute the script: all is fine.
Next, you cd to /somedir and execute the script: it fails. Why?
Because you include the text file relatively to the current working dir
(cwd), PHP expects the text file to be in /somedir, simular to:
And this is restricted, hence the error message. For this reason, using an
absolute path works, because this doesn't take the cwd into account.
The same applies to the safe_mode settings, which you also seem to use
according to the "Not owner" error.
To dynamically determine the absolute path, you could do something like:
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum