open_basedir, File() is not within the all

2020-05-08 08:02发布

问题:

I'm having an issue with Laravel, installed on a Media Temple DV:

tempnam(): open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/vhosts/mywebsite.com/:/tmp/)

This is the code that is giving this issue:

if (empty($this->cookie_file)) {
    $this->cookie_file = tempnam("", "phrets");
}

I'm thinking that it might be a permissions thing, but I'm really not too sure.

回答1:

It seems you need to add directory you use form tempnam into open_basedir or ask your server adminsitrator to turn it off (reference)