eaccelerator1.0解决与php5.4不兼容问题
2012年12月25日 ? 网站建设 ? 共 1677字 ? 字号 小 中 大 ? 评论 5 条 ? 阅读 1,658 views 次
顺利的升级到php5.4.10,本想用军哥的脚本偷下懒装下eaccelerator,运行完之后查看探针里还是no,运行一下php -v,错误如下
1
Failed loading /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so: /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so: cannot open shared object file: No such file or directory
军哥在论坛里解释说需要修改php.ini里ea那块no-debug-non-zts-20090626,可我到/usr/local/php/lib/php/extensions/下一看,只有no-debug-non-zts-20100525,里面根本没有eaccelerator.so~显然是安装失败!
随手动编译,具体过程不说了,我就知道最后make install之后又出错了:
/data1/lnmp/eaccelerator-0.9.6.1/eaccelerator.c: In function ‘eaccelerator_restore’:
/data1/lnmp/eaccelerator-0.9.6.1/eaccelerator.c:878: warning: assignment discards qualifiers from pointer target type
/data1/lnmp/eaccelerator-0.9.6.1/eaccelerator.c: In function ‘eaccelerator_compile_file’:
/data1/lnmp/eaccelerator-0.9.6.1/eaccelerator.c:1317: error: ‘zend_class_entry’ has no member named ‘line_start’
/data1/lnmp/eaccelerator-0.9.6.1/eaccelerator.c: At top level:
/data1/lnmp/eaccelerator-0.9.6.1/eaccelerator.c:1913: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘eaccelerator_functions’
/data1/lnmp/eaccelerator-0.9.6.1/eaccelerator.c:1938: error: ‘eaccelerator_functions’ undeclared here (not in a function)
make: *** [eaccelerator.lo] Error 1
谷歌了一下,看到不少人都有这样的错误,说是eaccelerator与php5.4不兼容,果断放弃转投xcache了~不过话说回来,eaccelerator这货已经死了六七年了吧,不兼容也是应该的,但俺还是不死心!
官网最新的eaccelerator,可以用于php5.4!这是新版的eaccelerator下载地址https://nodeload.github.com/eaccelerator/eaccelerator/legacy.tar.gz/master
下面来手动安装eaccelerator吧!(如果不想手动2、3步可以先运行下军哥eaccelerator.sh,然后再第一步即可)
1、解压压缩包并进入目录,依次运行:
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
注意参数里的路径
make
make install
OK,安装完毕!
2、编辑php.ini:
vim /usr/local/php/etc/php.ini
在最后添加:
;eaccelerator
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so"
eaccelerator.shm_size="1"
eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys = "disk_only"
eaccelerator.sessions = "disk_only"
eaccelerator.content = "disk_only"
3、创建eAccelerator缓存目录:
mkdir /usr/local/eaccelerator_cache
chmod 0777 /usr/local/eaccelerator_cache
4、重启
1
/etc/init.d/php-fpm restart
到这里看下探针,已经显示eAccelerator 1.0-dev了,php -v也正常了。