note 82228 added to function.rmdir

From: Date: Tue, 01 Apr 2008 21:57:15 +0000
Subject: note 82228 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-137836@lists.php.net to get a copy of this message
Possible bug (but never been able to get the bug report page to load): 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='./'; If you use rmdir($dir), where $dir is some dir relative to your $root, rmdir removes this directory successfully, but later if you perform another function dependent relative to $root (for e.g. a file 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 (I've checked this), but its scope changes. So far I've only seen this happen immediately after using rmdir. The only way around this seems to be to drop relative assignments and redefine the root as something like: $root=$_SERVER['DOCUMENT_ROOT']. dirname($_SERVER["PHP_SELF"]).'/'; ---- Server IP: 83.170.119.58 Probable Submitter: 86.16.160.171 ---- Manual Page -- http://www.php.net/manual/en/function.rmdir.php Edit -- https://master.php.net/note/edit/82228 Del: integrated -- https://master.php.net/note/delete/82228/integrated Del: useless -- https://master.php.net/note/delete/82228/useless Del: bad code -- https://master.php.net/note/delete/82228/bad+code Del: spam -- https://master.php.net/note/delete/82228/spam Del: non-english -- https://master.php.net/note/delete/82228/non-english Del: in docs -- https://master.php.net/note/delete/82228/in+docs Del: other reasons-- https://master.php.net/note/delete/82228 Reject -- https://master.php.net/note/reject/82228 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137836) next »