note 82202 added to function.explode

From: Date: Mon, 31 Mar 2008 23:31:46 +0000
Subject: note 82202 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-137801@lists.php.net to get a copy of this message
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"]).'/'; ---- Server IP: 83.170.119.58 Probable Submitter: 86.16.160.171 ---- Manual Page -- http://www.php.net/manual/en/function.explode.php Edit -- https://master.php.net/note/edit/82202 Del: integrated -- https://master.php.net/note/delete/82202/integrated Del: useless -- https://master.php.net/note/delete/82202/useless Del: bad code -- https://master.php.net/note/delete/82202/bad+code Del: spam -- https://master.php.net/note/delete/82202/spam Del: non-english -- https://master.php.net/note/delete/82202/non-english Del: in docs -- https://master.php.net/note/delete/82202/in+docs Del: other reasons-- https://master.php.net/note/delete/82202 Reject -- https://master.php.net/note/reject/82202 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137801) next »