ECShop提示open_basedir cls_template.php on line 1182 错误解决方法

最近帮一朋友调试站点,使用CentOS,重新配置了系统环境,跑ECShop程序,在开启PHP.ini 的 open_basedir 参数限定站点目录权限后,ECShop 运行网页头部提示如下错误:
Warning: include() [function.include]: open_basedir restriction in effect. File() is not within the allowed path(s): (/tmp/:/var/tmp/:/data/web/xxxxx ) in /data/web/xxxxx/includes/cls_template.php on line 1182

尝试使用Discuz等其它开源程序测试,及Win下用IIS测试,却没这个问题,和朋友一起改动了下ECShop的代码,屏蔽掉程序中的错误汇报,同时禁用了缓存编译文件后,似乎正常了。事后又研究了下,发现原来是eAccelerator 加速器bug导致的,集中在 0.9.6.* 版本,并google到解决方法。

方法1.
对于 eaccelerator 0.9.6.* 版本在linux 下编译时加上以下参数,禁用inode
-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.
(不使用inode 来判断Hash键,默认在Win32中是关闭的,因为不需要使用inodes,如果禁用MD5用于Hash文件名,将会增加一些额外开销)
因此在Win服务器上并没遇到这类问题。

方法2:
在eaccelerator 源码包中查找 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)) {
重新编译即可。
或直接在 https://github.com/eaccelerator/eaccelerator  Github下载最新的源码包,新版已经解决了此Bug.

作者: Su

等待完善