有时候,我们跑大量php程序的时候,希望能缓存加快速度。那么,可以考虑安装eaccelerator等加速缓存软件。但是,这类软件,有时候会带来意想不到的问题,请谨慎。Eaccelerator可以算是MMCache的“后继者"。这款软件的功能就是通过在内存中缓存PHP文件从而加速PHP程序的执行速度。由于 MMCache的原作者被Zend挖走,MMCache的开发一直处于停滞状态。而Eaccelerator却借鉴了MMCache的优点而一直在不断的更新。
如何在webmin安装eaccelerator缓存加速php程序?
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar tar xvfj eaccelerator-*.tar.bz2
tar xvfj eaccelerator-*.tar.bz2
cd eaccelerator-0.9.6.1
phpize
./configure
make
make install
vi /etc/php.d/eaccelerator.ini 创建配置文件
extension="eaccelerator.so"
eaccelerator.shm_size="0"
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"
mkdir -p /var/cache/eaccelerator
chmod 0777 /var/cache/eaccelerator
service httpd restart
判断eaccelerator是否安装成功:
[root@www.654z.com]# php -v
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP 5.2.13 (cli) (built: Feb 28 2010 16:22:50)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Suhosin v0.9.31, Copyright (c) 2007-2010, by SektionEins GmbH
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies