!
也想出现在这里? 联系我们
广告位
当前位置:首页>教程分享>服务器教程>香港云服务器安装宝塔后open_basedir restriction

香港云服务器安装宝塔后open_basedir restriction

使用宝塔配置laravel站点时,遇到open_basedir restriction in effect. 原因与解决方法

 

linux服务器部署thinkphp5的时候PHP报了这个错误,如下:

 

Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/zhuyuyun/thinkphp/start.php) is not within the allowed path(s): (/www/wwwroot/zhuyuyun/public/:/tmp/:/proc/) in /www/wwwroot/zhuyuyun/public/index.php on line 20

Warning: require(/www/wwwroot/zhuyuyun/thinkphp/start.php): failed to open stream: Operation not permitted in /www/wwwroot/zhuyuyun/public/index.php on line 20

Fatal error: require(): Failed opening required \'/www/wwwroot/zhuyuyun/public/../thinkphp/start.php\' (include_path=\'.:/www/server/php/56/lib/php\') in /www/wwwroot/zhuyuyun/public/index.php on line 20

或者报如下类似:

 

Warning: include_once(): open_basedir restriction in effect. File(../../staticpayb/WxPay.Config) is not within the allowed path(s):

出现问题的原因:

查看问题描述以及资料,发现是php open_basedir 配置的问题,PHP不能引入其授权目录上级及其以上的文件;

 

一般情况下是不会出现这种问题的,之所以出现这个问题绝大多数情况是由于服务器的原因,为了安全才做了这样的限制!

 

解决方法:

我首先要申明的是,下面的方法适合所有类似PHP报“open_basedir restriction in effect”错误的项目,并不仅仅只是适合thinkphp5的人。只要你的PHP报此错误都可以得到解决。

 

如果把ThinkPHP5部署在了LAMP/LNMP环境上很有可能出现白屏或500的情况,这个时候需要开启 php 错误提示来判断是否是因为设置了open_basedir选项出错?

给TA打赏
共{{data.count}}人
人已打赏
服务器教程

Linux黑屏进不去登录界面(Linux启动黑屏)

2021-4-17 18:44:35

服务器教程

IIS7运行ASP程序提示不支持FSO的解决办法

2021-4-17 18:44:37

声明 本站上的部份代码及教程来源于互联网,仅供网友学习交流,若您喜欢本文可附上原文链接随意转载。无意侵害您的权益,请发送邮件至 [email protected] 或点击右侧 私信:吉吉国王 反馈,我们将尽快处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
OneEase