By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

odd basedir() err or

P: n/a
I'm surprised to get an open_basedir error when I'm not only in the
correct folder for web documents, but I'm an extra layer deep. Basedir
is usually there to restrict how high up in the directory structure a
PHP fopen or include statement can reach, yes? The idea is to keep
someone in a hosted environment from launching an attack by including
files, or opening them, that are outside of the web environment? How do
I change the basedir?
Warning: MkDir failed (Permission denied) in
/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/setup/neededFiles/writeAllNeededFolders.php
on line 11

Warning: open_basedir restriction in effect. File is in wrong directory
in
/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/setup/neededFiles/writeAllNeededFolders.php
on line 12

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

lk******@geocities.com wrote:
I'm surprised to get an open_basedir error when I'm not only in the
correct folder for web documents, but I'm an extra layer deep. Basedir is usually there to restrict how high up in the directory structure a
PHP fopen or include statement can reach, yes? The idea is to keep
someone in a hosted environment from launching an attack by including
files, or opening them, that are outside of the web environment? How do I change the basedir?
Warning: MkDir failed (Permission denied) in
/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/setup/neededFiles/writeAllNeededFolders.php on line 11

Warning: open_basedir restriction in effect. File is in wrong directory in
/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/setup/neededFiles/writeAllNeededFolders.php on line 12


I guess I'm looking for the right .htaccess directive to insert the
line

php_admin_value open_basedir none
Do I look to Apache for this, or www.php.net?

Jul 17 '05 #2

P: n/a
I fixed this by using DOCUMENT_ROOT and therefore an absolute address,
rather than a relative one. This is apparently a known bug, you
sometimes get the open_basedir error when using relative paths.

In the end I went:

$root = $GLOBALS["SCRIPT_NAME"];
$root = str_replace("setup.php", "", $root);

The last line was to get the name of the file out of the directory
path. Isn't there another way to get the path, without the file name?

Jul 17 '05 #3

P: n/a
lk******@geocities.com wrote:
I fixed this by using DOCUMENT_ROOT and therefore an absolute address,
rather than a relative one. This is apparently a known bug, you
sometimes get the open_basedir error when using relative paths.

In the end I went:

$root = $GLOBALS["SCRIPT_NAME"];
$root = str_replace("setup.php", "", $root);

The last line was to get the name of the file out of the directory
path. Isn't there another way to get the path, without the file name?


Use strrpos to find the last position of "/", then substr it from the
first position to the position returned from strrpos.
Jul 17 '05 #4

P: n/a
On 20 Dec 2004 11:54:15 -0800, lk******@geocities.com wrote:
I fixed this by using DOCUMENT_ROOT and therefore an absolute address,
rather than a relative one. This is apparently a known bug, you
sometimes get the open_basedir error when using relative paths.

In the end I went:

$root = $GLOBALS["SCRIPT_NAME"];
$root = str_replace("setup.php", "", $root);

The last line was to get the name of the file out of the directory
path. Isn't there another way to get the path, without the file name?


http://php.net/manual/en/ref.filesystem.php
http://php.net/dirname

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.