当前位置: > CentOS > CentOS服务器 > 环境配置 >

PHP 強化模块 (eaccelerator)安装

时间:2014-10-23 15:46来源:linux.it.net.cn 作者:it
1.先到eaccelerator官方网站下载软件包
http://eaccelerator.net/
2.解压
软件包在/root/ 解压到/usr/local/src
  1. tar -zxvf /root/eaccelerator-eaccelerator-42067ac.tar.gz
复制代码
3.安装
  1. cd eaccelerator-eaccelerator-42067ac/
  2. phpize
  3. ./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-config
  4. make
  5. make test
  6. make install
复制代码
4. 预先载入 PHP 的模块:
  1. echo "/usr/lib64/php/modules/" >> /etc/ld.so.conf.d/php.conf
  2. ldconfig
复制代码
5.修改 php.ini
  1. vim /etc/php.ini
复制代码
在最下面添加
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"
6.重启服务
  1. service httpd restart
复制代码
7.测试
  1. [root@localhost html]# vim phpinfo.php
复制代码
<?php phpinfo() ?>
访问phpinfo.php出现如下图所示表示安装正确
  1. [root@localhost html]# ab -dSk -c 100 -n 100 <a href="http://192.168.124.149/phpinfo.php" target="_blank">http://192.168.124.149/phpinfo.php</a>
复制代码
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.124.149 (be patient).....done


Server Software:        Apache/2.2.15
Server Hostname:        192.168.124.149
Server Port:            80

Document Path:          /phpinfo.php
Document Length:        51319 bytes

Concurrency Level:      100
Time taken for tests:   1.118 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      5149100 bytes
HTML transferred:       5131900 bytes
Requests per second:    89.42 [#/sec] (mean)
Time per request:       1118.301 [ms] (mean)
Time per request:       11.183 [ms] (mean, across all concurrent requests)
Transfer rate:          4496.48 [Kbytes/sec] received

Connection Times (ms)
              min   avg   max
Connect:       42    84  115
Processing:   106   615  960
Total:        148   699 1075 (责任编辑:IT)
------分隔线----------------------------