eaccelerator0.9.5.3模块安装

摘要: 当然环境用的军哥的lnmp一键包,当前版本Centos6.9 nginx1.10 php5.5.36 mysql5.6.29 因为当前公司有网站需要迁移,在迁移的过程中,发现eaccelerator0.

当然环境用的军哥的lnmp一键包,当前版本Centos6.9 nginx1.10 php5.5.36 mysql5.6.29

因为当前公司有网站需要迁移,在迁移的过程中,发现eaccelerator0.9.5.3无法在现有php版本运行,经过一番查找,发现eaccelerator0.9.5.3版本只支持php5.2.x版本,并且只有这个版本支持数据缓存,好坑有没有~

目前eaccelerator最新的版本是1.0dev,最高只支持5.4.x,而且只是对php做加速处理(PS:已经好几年不更新了,如果不是程序需要,就不要搞它了)

因为当前php版本是5.5.36的,并且当前已经有网站在运行了,为了不影响当前网站的访问,我这里并存一个php5.2的版本(php共存方式,我博客有写,此处不在说明)

下载及编译安装

下载eaccelerator-0.9.5.3包

wget http://down.whsir.com/downloads/eaccelerator-0.9.5.3.tar.bz2
tar xf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
/usr/local/php52/bin/phpize

根据自己phpize的位置来运行即可(不知道phpize在哪的直接find / -name phpize查找),运行完提示下面信息,然后编译即可

Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525

编译(注意:要想使用共存内存缓存功能eaccelerator_get and eaccelerator_put among others,此处必须要这么编译,如果不按这种方式编译,php会报Call to undefined function eaccelerator_get() in错误)

./configure --enable-eaccelerator=shared --with-eaccelerator-shared-memory --with-eaccelerator-info --with-eaccelerator-sessions --with-eaccelerator-content-caching --with-eaccelerator-disassembler --with-eaccelerator-debug --with-php-config=/usr/local/php52/bin/php-config
make && make install

上述执行完后会有如下提示:

Installing shared extensions: /usr/local/php52/lib/php/extensions/no-debug-non-zts-20100525/

通过ll就可以到该模块了

ll /usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525/

修改php.ini文件

vim /usr/local/php52/etc/php.ini

直接在最下面添加

[eaccelerator]
zend_extension="/usr/local/php52/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/tmp/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter="*.php"
eaccelerator.log_file="/usr/local/eaccelerator_log"
eaccelerator.shm_max="0"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_ttl="300"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.allowed_admin_path = "/opt/www/control"
eaccelerator.name_space = "whsir"

eaccelerator提供了监控与管理eAccelerator缓存的功能,通过control.php来管理,所以此处拷贝到相应网站目录下(不是必须的)

cp control.php /opt/www/control/control.php

默认帐号密码为

admin
eAccelerator

创建eaccelerator_cache目录

mkdir /tmp/eaccelerator_cache

修改下目录权限

chmod -R 777 /tmp/eaccelerator_cache

重启php52服务

/etc/init.d/php52-fpm restart

此时打开phpinfo就可以看到该模块了

​​​​​​​

原文链接

猜你喜欢

转载自3554661963.iteye.com/blog/2384033