Saturday, 23 September 2017

php - Unlink Fails -> open_basedir issue Warning: unlink() [function.unlink]: open_basedir restriction in effect. File() is not within the allowed path(s):



Warning: unlink() [function.unlink]: open_basedir restriction in effect. File() is not within the allowed path(s):




is what i'm getting for the code



if (file_exists($thumb)) {
echo "$thumb";
$fh = fopen($thumb, 'w') or die("can't open file");
fclose($fh);
unlink($myFile);
}



I can confirm that the path of $thumb is correct.



Any fixes?



Thanks in advance.


Answer



Look in your php.ini setup. The open_basedir configuration setting restricts which areas of the filesystem your PHP script can access; if the file you're trying to delete is outside any directories specified there the unlink() call will fail.


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...