引用官方:
eAccelerator is a free open-source PHP accelerator, optimizer, and
dynamic content cache. It increases the performance of PHP scripts by
caching them in their compiled state, so that the overhead of compiling
is almost completely eliminated. It also optimizes scripts to speed up
their execution.
eAccelerator typically reduces server load and
increases the speed of your PHP code by 1-10 times.
下面就以我的CentOS 5.0为例介绍一下:
Step1 准备工作 - php4 or php5 php-devel
- autoconf
- automake
- libtool
- m4
Step2 安装
下载
tar xvjf eaccelerator-0.9.5.2.tar.bz2
cd eaccelerator-0.9.5.2
phpize
./configure && make && sudo make install
Step3 配置
sudo vi /etc/php.d/accelerator.ini
accelerator.ini内容如下:
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
|
具体个参数意义请参照
Step4 收尾工作
mkdir -p /var/cache/eaccelerator
chmod 0777 /var/cache/eaccelerator
sudo service httpd restart
现在 php -v 应该如下显示:
$ php -v
PHP 5.1.6 (cli) (built: Mar 14 2007 18:56:07)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
具体效果嘛,自己测试看看了。呵呵
阅读(1958) | 评论(0) | 转发(0) |