作業系統:Linux
# 1、先安裝ZendOptimizer -3.2.2
# wget http://www.vista.ac.cn/linux/down/ZendOptimizer/ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz # tar zxvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz # cd ZendOptimizer-3.2.2-linux-glibc21-i386 # ./install.sh
在Please specify the location for installing ZendOptimizer:提示後輸入ZendOptimizer安裝路徑,例如/data/webserver/zend
2、再安裝eaccelerator-0.9.5加速軟體(建議學習:PHP影片教學)
# wget http://www.vista.ac.cn/linux/down/eaccelerator/eaccelerator-0.9.5.tar.bz2 # tar jxvf eaccelerator-0.9.5.tar.bz2 # cd eaccelerator-0.9.5
# export PHP_PREFIX="/data/webserver/php" # $PHP_PREFIX/bin/phpize # ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config # make # make install
[eaccelerator] extension="/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so" eaccelerator.shm_size="32" eaccelerator.cache_dir="/data/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 /data/cache/eaccelerator # chmod 0777 /data/cache/eaccelerator
# service httpd restart
3、檢查ZendOptimizer和eaccelerator是否安裝成功
建立一個phpinfo.php文件,內容如下:<?php phpinfo(); ?>
This program makes use of the Zend Scripting Language Engine: Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies with Zend Optimizer v3.2.2, Copyright (c) 1998-2006, by Zend Technologies
extension="/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="32"
# echo 字节数 > /proc/sys/kernel/shmmax
kernel.shmmax = 字节数
eaccelerator.cache_dir="/data/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"
解释:当没有足够的空闲共享内存去尝试缓冲一个新脚本时,将删所有旧脚本,前提是这个尝试在超过shm_prune_period秒之前被执行过。默认值为"0",表示不尝试从共享内存中删除任何旧的脚本。(单位为秒)
--------------------
eaccelerator.shm_only="0"
解释:打开或者关闭在磁盘上缓存编译过的脚本。这个参数对会话数据和内容缓存没有效果。默认值为"0",表示使用磁盘和共享内存来缓存。
--------------------
eaccelerator.compress="1"
解释:打开或者关闭缓存内容压缩。"1"指打开,"0"指关闭。默认值为"1"。
--------------------
eaccelerator.compress_level="9"
解释:内存压缩的级别。默认值为"9",表示最大压缩。
参考资料:
1、Installing from source (http://www.eaccelerator.net/wiki/InstallFromSource)
2、eAccelerator settings (http://www.eaccelerator.net/wiki/Settings)
以上是安裝及設定eaccelerator-0.9.5加速PHP-5.2.1的詳細內容。更多資訊請關注PHP中文網其他相關文章!