赵荣涛's Archivers

From admin on 2011-07-19 11:14:52

错误:Warning: include() [function.include]: open_basedir restriction in effect. File() is not within the allowed path(s)原因及解决办法

一个很奇怪的问题,有关require,include和require_once,include_once


设置了open_basedir
只要使用require或include包含文件(不管是./xx.php还是xx.php)都是报下面的错误
Warning: include() [function.include]: open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/:/tmp/:/var/cache/) in /var/www/testdir.php on line 2
而且修改php.ihi error_reporting = E_ALL & ~E_NOTICE还是会产生
FastCGI sent in stderr: "PHP Warning:  include() [function.include]: open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/:/tmp/:/var/cache/) in /var/www/testdir.php on line 2" while reading response header from upstream, client: 192.168.1.63, server: localhost, request: "GET /testdir.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.207"

但是奇怪的是用require_once或include_once就不会有任何的warning或错误

这是为什么?

原来是eaccelerator的原因。
官方说明
--without-eaccelerator-use-inode
Don't use inodes to determine hash keys. This is turned off by default in win32 because it doesn't use inodes. If disabled md5 is used to hash the filenames, which adds extra overhead.

查看完整版本: 错误:Warning: include() [function.include]: open_basedir restriction in effect. File() is not within the allowed path(s)原因及解决办法

From LAVA on 2012-03-05 11:23:48

without-eaccelerator-use-inode 还是不行。

From 飘云 on 2013-04-29 17:47:57

请问下你是怎么解决的呢? 是不是关闭eaccelerator来解决呢 有没有办法在不关闭eaccelerator情况下解决这个bug呢?

Tags: