open_basedir 设置后不能访问的解决方法之一
Warning: Unknown: open_basedir restriction in effect. File() is not within the allowed path(s): (.:/tmp/) in Unknown on line 0
Fatal error: Can’t load /XX/index.php, open_basedir restriction. in Unknown on line 0
出现了很多次这样的问题了,感觉都无从下手,总觉得与系统和php有关, 今天又出现了, 想来想去都觉得不奇怪, 后面开始重新编译php, php的扩展都没编译,发现设置open_basedir的时候,却没有出错^^^ , 从这个信息觉得有些可以利用的,把自己方案所需的扩展都安装进去,重启apache的时候,却发现有出现这个错误, 把php.ini中设置的扩展一个一个的关闭,开始排查,后面吧eaccelerator注释掉后,重启apache并没有出现错误, 定位问题出现eaccelerator, 在用google查了下,发现eaccelerator 0.9.6后的版本跟以前的有些改变,把open_basedir给限制了,这时我们要把限制去掉才行
下载eaccelerator 0.9.6后先不要安装,解包后找到eaccelerator.c这个文件,打开第1156行,这样的:
if (PG(open_basedir) && php_check_open_basedir(realname TSRMLS_CC)) {
修改成:
if (PG(open_basedir) && php_check_open_basedir(file_handle->filename TSRMLS_CC)) {
修改后在进行编译,就ok了

2010/11/16 于 15:55:09
In my opinion you are not right. I can defend the position. Write to me in PM, we will communicate.