0712-2888027 189-8648-0214
微信公众号

孝感风信网络科技有限公司微信公众号

当前位置:主页 > 技术支持 > PHP > 解决Laravel Warning: require(): open_basedir restriction in effect.错误

解决Laravel Warning: require(): open_basedir restriction in effect.错误

时间:2021-07-23来源:风信官网 点击: 1277次
新项目布置Laravel,所有源代码数据上传至服务器中,配置好运行环境,调试出现如下错误提示:
 
Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/new.xin-lian.cn/vendor/autoload.php) is not within the allowed path(s): (/www/wwwroot/new.xin-lian.cn/public/:/tmp/:/proc/) in /www/wwwroot/new.xin-lian.cn/public/index.php on line 24
 
Warning: require(/www/wwwroot/new.xin-lian.cn/vendor/autoload.php): failed to open stream: Operation not permitted in /www/wwwroot/new.xin-lian.cn/public/index.php on line 24
 
Fatal error: require(): Failed opening required '/www/wwwroot/new.xin-lian.cn/public/../vendor/autoload.php' (include_path='.:/www/server/php/73/lib/php') in /www/wwwroot/new.xin-lian.cn/public/index.php on line 24
 
经检查发现是宝塔中.user.ini中open_basedir的配置有误,解决方法如下:
 
编辑user.ini
chattr -i .user.ini
vim .user.ini
open_basedir=/home/wwwroot/ithov.net/:/tmp/:/proc/
改为
open_basedir=/home/wwwroot/ithov.net/public/ :/tmp/:/proc/
然后
chattr +i .user.ini
最后重启PHP或者Nginx
重启PHP
/etc/init.d/php-fpm restart
重启Nginx
service nginx restart
栏目列表
推荐内容
热点内容
展开