tp5 base.php,宝塔面板中ThinkPHP5报错/public/../thinkphp/base.php

今天在部署一个ThinkPHP5开发的网站时,把网站根目录指向到public目录下,结果运行后产生以下错误

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

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

Fatal error: require(): Failed opening required '/www/wwwroot/xxx/public/../thinkphp/start.php' (include_path='.:/www/server/php/70/lib/php') in /www/wwwroot/xxx/public/index.php on line 18

到宝塔面板的网站配置页面,发现有一个“防跨站攻击(open_basedir) 的选项”把该选项关闭即可。

51975fa06a8984eaf066386a682dbb76.png

原因如下:open_basedir 将PHP所能打开的文件限制在指定的目录树中,包括文件本身。当程序要使用例如fopen()或file_get_contents()打开一个文件时,这个文件的位置将会被检查。当文件在指定的目录树之外,程序将拒绝打开。

如果首页能打开了,内页打不开,设置一下伪静态为thinkphp试试

c573ecd1a59e4e29fcf3f1068cb95a06.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值