note 82202 deleted from function.explode by nlopess
| From: | nlopess@php.net | Date: | Tue, 01 Apr 2008 21:55:43 +0000 |
| Subject: | note 82202 deleted from function.explode by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137835@lists.php.net to get a copy of this message | ||
Note Submitter: adrian dot stannard at icps2007 dot org
----
Use of rmdir() and relative directory scope / open_basedir restriction.
I cannot find much mention of this, but if you are on a server with open_basedir restriction and you
use relative links in your script, for e.g. you define a root directory as $root='./';
then use rmdir($dir), where $dir is some dir relative to your $root, rmdir removes this, but later
if you perform another function dependent upon $root (or an include) you get an error:
open_basedir restriction in effect
File(./includes/page_header.php) is not within the allowed path(s):
/home/[account_name]:/usr/lib/php:/usr/local/lib/php:/tmp
the $root variable itself is unchanged, but its scope changes. So far I've only seen this
happen with rmdir.
The only way around this seems to be to drop relative assignments and define the root as something
like:
$root=$_SERVER['DOCUMENT_ROOT']. dirname($_SERVER["PHP_SELF"]).'/';