phpcms install/install.php,PHPCMS安装文件install.php里面include '../phpcms/base.php'无效

打开安装,提示No permission resources.,初步确定是因为没有定义IN_PHPCMS。

include '../phpcms/base.php';

define('INSTALL_MODULE',true);

defined('IN_PHPCMS') or exit('No permission resources.');//在这里出错

我想,难道是因为没有找到../phpcms/base.php?

echo dirname(__FILE__).'/../phpcms/base.php';

在终端使用输出的地址,发现没问题,能编辑到,为什么呢?从上到下的权限都是www:www(755)。我在../phpcms/目录下面新建了一个test.php(代码为return 'test')。

然后在install.php里写

echo include dirname(__FILE__).'/../phpcms/test.php';

exit;

本地能正常输出,测试服务器上没有内容输出。因为是../phpcms/base.php,所以考虑到phpcms父目录的权限是否够,权限也是www:www(755)。

扯了这么多,就一句话:文件存在,权限也应该够,在本地能包含到,但是在服务器上却包含不到?

测试服务器,调试应该默认开启错误显示,和先说错误的级别,居然忘记了这个,在install.php最开始添加

ini_set('display_errors','On');

error_reporting(E_ALL);

报错内容为:

Warning: include(): open_basedir restriction in effect. File(/home/wwwroot/webtest/test1/phpcms/test.php) is not within the allowed path(s): (/home/wwroot/webtest/test1/:/tmp/) in /home/wwwroot/webtest/test1/install/install.php on line 6

Warning: include(/home/wwwroot/webtest/test1/phpcms/test.php): failed to open stream: Operation not permitted in /home/wwwroot/webtest/test1/install/install.php on line 6

Warning: include(): Failed opening '/home/wwwroot/webtest/test1/install/../phpcms/test.php' for inclusion (include_path='/home/wwwroot') in /home/wwwroot/webtest/test1/install/install.php on line 6

这个问题以前没有遇到过,又是一片知识空白。

include操作时,open_baseidr约束导致了错误。为什么第一行里说的,/home/wwwroot/webtest/test1/phpcms/test.php文件不在允许的路径/home/wwroot/webtest/test1/:/tmp/里,为什么这里的路径是/home/wwroot,而非/home/wwwroot?

也就是说我现在项目的open_baseidr是/home/wwroot/webtest/test1/,打开测试服务器的php.ini文件查看,发现了Zend Optimizer模块,里面对各个虚拟主机的open_baseidr做了限定。

571d882504825b01eb66a99b84606afe.png

我将其修改为了

[HOST=xxx.com]

open_basedir=/home/wwwroot/webtest/test1/:/tmp/

[PATH=/home/wwwroot/webtest/test1]

open_basedir=/home/wwwroot/webtest/test1/:/tmp/

重启了php-fpm,再访问OK了。一次纠结的调错,关于这里的Zend Optimizer模块是如何自动生成的,为什么会出错?难道是我最开始在创建虚拟主机的时候写成了/home/wwroot/,而后期再修改,它却有没跟着修改?

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值