php错误提示 open_basedir restriction in effect 解决

今天在帮助一个朋友配置一台服务器时发现网站配置好了缓存目录读写不成功,在打开错误时发现提示 Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(../license.php) is not within the allowed path(s): 错误了,下面一起来看此问题解决办法

先来看配置文件

$cache = new Cache(43200,'D:/wwwroot/cache/tmp/anzhuo/');//参数1 秒,参数2内容
$page = intval(isset($_GET['page'])?$_GET['page']:1);
$key = 'anzhuo_data_4'.$page;
$values = $cache->display($key);

这个是生成缓存文件了,但是发现生成是提示

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(../license.php) is not within the allowed path(s):


问题是出现在了PHP.INI上面了
 原因是php.ini里设置了  

open_basedir=/var/web/w0895/:/tmp:/usr/lib/php

这里加上相关的目录就可以了

解答:
其实open_basedir 这个是用来限制php的目录访问权限什么的,如果不在允许的范围内,php就不能访问。
这个 open_basedir 在 php.ini 里可以设定,也可以在 apache的httpd.conf 里面设定

例如:

php_admin_value open_basedir "D:/wwwroot/cache/tmp/anzhuo/"

再比如:

php_admin_value open_basedir =/var/web/w0895/:/tmp:/usr/lib/php

好了再重启apache问题解决了。


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值