下载Zend Optimizer

http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

1tar -xzvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
2cd ZendOptimizer-3.3.9-linux-glibc23-i386
3cd data
4cd 5_1_x_comp
5cp ZendOptimizer.so /usr/lib/php/modules/

修改配置文件vim /etc/php.ini 加入如下两行

1zend_optimizer.optimization_level=15 #启动多少优化过程
2zend_extension=/usr/lib/php/modules/ZendOptimizer.so

然后重启下httpd服务,用phpinfo()查看,发现了

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

安装eAccelerator

1wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2
2#bzip2 -d eaccelerator-0.9.6.tar.bz2
3#tar -xvf eaccelerator-0.9.6.tar
4#cd eaccelerator-0.9.6
5#/usr/bin/phpize
6#./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config
7#make
8#cp modules/eaccelerator.so /usr/lib/php/modules/

vim /etc/php.ini 添加信息如下:

 1[eaccelerator]
 2extension=eaccelerator.so
 3eaccelerator.shm_size=64 ;此处是加速器使用的共享内存的大小
 4eaccelerator.cache_dir=/tmp/eaccelerator
 5eaccelerator.enable=1
 6eaccelerator.optimizer=1
 7eaccelerator.check_mtime=1
 8eaccelerator.debug=0
 9eaccelerator.log_file=/var/log/httpd/eaccelerator.log
10eaccelerator.filter=
11eaccelerator.shm_max=0
12eaccelerator.shm_ttl=0
13eaccelerator.shm_prune_period=0
14eaccelerator.shm_only=0

修改完php.ini文件后,设置一下缓存文件夹的权限

1#mkdir /tmp/eaccelerator
2#chmod 777 /tmp/eaccelerator

然后重启httpd服务器,然后查看phpinfo(),在其中有如下记录:

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.6, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

当然也可以通过php -i|grep Zend 和php -i |grep eAccelerator查看是否已安装成功。php版本的查看可以通过php -v查看。