本次教程的环境是lamp安装教程,apache版本是wdcp默认的2.2,php是我自己升级的5.4。按照wdcp官网的教程安装eAccelerator尝试多次失败后决心去找到问题在哪里。一番周泽后发现问题在eAccelerator0.9.6.1版本不支持5.4这就是问题所在。所以需要最新版本
本次教程的环境是 lamp,apache版本是wdcp默认的2.2,php是我自己升级的5.4。
按照wdcp官网的教程安装eAccelerator尝试多次失败后决心去找到问题在哪里。
经过一番周泽啊本屌丝终于找到了问题所在,官网的eAccelerator版本是0.9.6.1,在一篇关于lnmp安装eAccelerator的教程中发现0.9.6.1版本支持php5.2和5.3不支持5.4这就是问题所在。
教程正式开始。本次教程是本博客安装eaccelerator的全过程有点啰嗦请见谅。
需要的工具有:安装wdcp面板加php5.4的主机或服务器,还有官方的eAccelerator最新版本,安装好之后显示版本是1.0-dev。
本人是一个新手只会瞎折腾专业术语不懂,更别说版本号了解多少了。
第一步:下载eAccelerator最新版本
那么找到官网http://eAccelerator.net。官网有两个格式的压缩包随便下载哪一个都行。
github:https://github.com/eaccelerator/eaccelerator
上传到服务器上解压缩。
我下载的 zip格式。
[root@home]# unzip master1.zip
解压好之后进入第二部。
[root@ home]# cd eaccelerator-eaccelerator-42067ac/
切换到解压的目录里,就是eaccelerator-eaccelerator-42067ac目录。
[root@ eaccelerator-eaccelerator-42067ac]# ls AUTHORS control.php doc ea_dasm.c ea_restore.h Makefile.frag opcodes.c README.win32 bugreport.php COPYING eaccelerator.c ea_dasm.h ea_store.c Makefile.in opcodes.h win32 ChangeLog dasm.php eaccelerator.h ea_info.c ea_store.h mm.c optimize.c config.m4 debug.c eaccelerator.ini ea_info.h fnmatch.c mm.h PHP_Highlight.php config.w32 debug.h eaccelerator_version.h ea_restore.c fnmatch.h NEWS README
在目录里进行配置操作。其实配置在github里有说明。
配置步骤:
[root@ eaccelerator-eaccelerator-42067ac]# /www/wdlinux/apache_php/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
apache_php是一个连接文件,就是快捷方式,就不用去输入php后面的版本号了。
[root@ eaccelerator-eaccelerator-42067ac]# ./configure --enable-eaccelerator=shared --with-php-config=/www/wdlinux/apache_php/bin/php-config --with-eaccelerator-shared-memory
configure: WARNING: unrecognized options: --with-eaccelerator-shared-memory
然后是上面这一步配置php路径。这是官方给的编辑代码,会报错。这个报错的意思是提示–with-eaccelerator-shared-memory是一个无效的指令。
我也纠结了半天后来拿到翻译去翻译的。
所以我们删除最后–开始一直到结束。使用下面的命令
[root@ eaccelerator-eaccelerator-42067ac]# ./configure --enable-eaccelerator=shared --with-php-config=/www/wdlinux/apache_php/bin/php-config
config.status: config.h is unchanged
到这一步就成功一半了,然后make
[root@ eaccelerator-eaccelerator-42067ac]# make
----------------------------------------------------------------------
Libraries have been installed in:
/home/eaccelerator-eaccelerator-42067ac/modules
............................省略了
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete. 建立完整的。
Don't forget to run 'make test'. 别忘了测试运行。
这一步就已经安装完成了。
可以到php/bin/查看是否有eaccelerator文件。
最后一部配置php.ini
把下面的代码粘贴到php.ini最后面。只是方便所以加在最后面。
[eaccelerator]
zend_extension="/www/wdlinux/apache_php-5.4.26/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so"
eaccelerator.shm_size="1"
eaccelerator.cache_dir="/www/wdlinux/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"
可以清楚的看到这两条配置。
一个是扩展的位置,一个是配置缓存位置。
zend_extension="/www/wdlinux/apache_php-5.4.26/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so"
eaccelerator.cache_dir="/www/wdlinux/eaccelerator_cache" //配置缓存位置
扩展的位置可以通过make install获取。
[root@ eaccelerator-eaccelerator-42067ac]# make install
Installing shared extensions: /www/wdlinux/apache_php-5.4.26/lib/php/extensions/no-debug-non-zts-20100525/
然后我们在创建缓存文件夹。mkdir,然后重启服务。
[root@ wdlinux]# mkdir eaccelerator_cache
[root@ /]# service httpd restart
结果截图。好了完成了,本次教程是本博客亲自安装的全过程。
进入设置的缓存目录也能看到缓存已经被生成了。
[root@ wdlinux]# cd eaccelerator_cache/
[root@ eaccelerator_cache]# ls
1000
[root@ eaccelerator_cache]# cd 1000/
[root@ 1000]# ls
0 1 2 3 4 5 6 7 8 9 a b c d e f
[root@ 1000]# cd 0
[root@ 0]# ls
0 1 2 3 4 5 6 7 8 9 a b c d e f
[root@ 0]# cd 0
[root@ 0]# ls
eaccelerator-0048c9a1386c970bdc8043077351996f