一、配置,在nginx和apache所在的服务器中:
1.配置:cd /application/php/lib/php.ini
1)extension_dir="/application/php/lib/php/extensions/no-debug-non-zts-20090626/"
2)结尾添加:extension = memcache.so
extension = pdo_mysql.so
extension = imagick.so
2.配置eaccelerator缓存目录
mkdir -p /tmp/eaccelerator (将缓存放在ssd固态硬盘或者内存文件系统tmpfs)
授权: chown -R nginx.nginx /tmp/eaccelerator
授权: chown -R www.www /tmp/eaccelerator
查看apache的用户: egrep "User|Group" /application/apache/conf/httpd.conf(查看用户)
添加参数:
[eaccelerator]
extension=eaccelerator.so
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/tmp/eaccelerator"
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"
EOF
cd /tmp/eaccelerator/
查看当前的文件:find /tmp/eaccelerator/ -type f
二、 配置xcache(和eacc任选一个)
cd /application/php/lib/php.ini
vi /home/oldboy/tools/xcache-1.3.2/xcache.ini将第3行注释掉,第5行注释掉,第八行去掉注释;
cat /home/oldboy/tools/xcache-1.3.2/xcache.ini >>/application/php/lib/php.ini ---将上述文件放到php.ini的文件里面
/application/php/bin/php -v ---查看加速器加载情况