Unlink Fails -> open_basedir issue Warning: unlink

2019-08-20 06:53发布

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 "<b>$thumb</b>";
    $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.

1条回答
ゆ 、 Hurt°
2楼-- · 2019-08-20 07:28

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.

查看更多
登录 后发表回答