laravel 报错 open_basedir restriction in effect

Warning: require(): open_basedir restriction in effect. File(xxx/xxx/bootstrap/autoload.php) is not within the allowed path(s): (xxx/xxx/public/:/tmp/:/proc/) in xxx/xxx/public/index.php on line 22
原因:public目录下生成了一个文件:.user.ini ,里面有个open_basedir被定义到了public目录下面, 但是laravel的主程都在public外面,所以访问public目录以外的文件会被.user.ini 里面的open_basedir限制。 所以就报错了。
解决办法:
删掉.user.ini 里面的open_basedir 的目录值最后的public
修改的时候会提示没权限 Operation not permitted,因为文件被一些软件或者管理平台使用chattr命令上了锁, 执行下面命令解锁。

然后就能编辑了。

 

 

发表评论

邮箱地址不会被公开。 必填项已用*标注