THINKPHP搭建报错Warning: require(): open_basedir restriction in effect.File() is not within the allowed

问题:LNMP 环境下搭建 Thinkphp5 报错如下

Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/store/thinkphp/base.php) is not within the allowed path(s): (/home/wwwroot/store/public/:/tmp/:/proc/) in /home/wwwroot/store/public/install.php on line 18

Warning: require(/home/wwwroot/store/thinkphp/base.php): failed to open stream: Operation not permitted in /home/wwwroot/store/public/install.php on line 18

Fatal error: require(): Failed opening required '/home/wwwroot/store/public/../thinkphp/base.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/store/public/install.php on line 18

解决思路:
因为LNMP默认是不允许跨目录访问的,而TP框架根目录是指向public下的,须访问上一层文件,所以都是必须要将防跨目录访问的设置去掉。

  1. 可以删掉public下面的.user.ini隐藏文件。
    一般要使.user.ini生效,需要打开php.ini 中的这两个参数
    user_ini.filename = “.user.ini”
    user_ini.ca

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值