免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1988 | 回复: 0
打印 上一主题 下一主题

安装eaccelerator加速PHP [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-07-09 14:13 |只看该作者 |倒序浏览
1、下载安装
##官网:
http://www.eaccelerator.net
cd /opt/distfiles
wget -c
http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xjf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
./configure  --enable-eaccelerator=shared --with-php-config=/opt/modules/phpcgi/bin/php-config
make && make install

注:eaccelerator 会安装在 /opt/modules/phpcgi/lib/php/extensions/no-debug-non-zts-20060613/ 这个目录
2、配置php.ini
vi /opt/modules/phpcgi/lib/php.ini
找到 cgi.fix_pathinfo 修改为 cgi.fix_pathinfo = 1
然后在下面加入
extension="eaccelerator.so"
eaccelerator.shm_size="16"
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="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
然后将 extension_dir 修改为:
extension_dir = "/opt/modules/phpcgi/lib/php/extensions/no-debug-non-zts-20060613/"

mkdir /tmp/eaccelerator
chmod 777 /tmp/eaccelerator

3、检查是否成功加载eaccelerator
重起web服务,查看info.php是否显示:Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

或运行/opt/modules/phpcgi/bin/php -v
PHP 5.2.5 (cli) (built: Jul  4 2008 16:57:30)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

4、测试性能
ab  -c 1000 -n 2000
http://192.168.0.235/info.php
测试后发现eaccelerator将php执行速度提升了近2倍。

加载后:
Concurrency Level:      1000
Time taken for tests:   5.616362 seconds
Complete requests:      2000
Failed requests:        0
Write errors:           0
Total transferred:      13562546 bytes
HTML transferred:       12853452 bytes
Requests per second:    356.10 [#/sec] (mean)
Time per request:       2808.181 [ms] (mean)
Time per request:       2.808 [ms] (mean, across all concurrent requests)
Transfer rate:          2358.11 [Kbytes/sec] received
加载前:
Concurrency Level:      1000
Time taken for tests:   10.76328 seconds
Complete requests:      2000
Failed requests:        3
   (Connect: 0, Length: 3, Exceptions: 0)
Write errors:           0
Total transferred:      13551498 bytes
HTML transferred:       12828800 bytes
Requests per second:    198.49 [#/sec] (mean)
Time per request:       5038.164 [ms] (mean)
Time per request:       5.038 [ms] (mean, across all concurrent requests)
Transfer rate:          1313.28 [Kbytes/sec] received




本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/21459/showart_1076806.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP