4.测试是否可以成功启动:
测试启动并查看是否监听在80端口:
[root@localhost ~]# httpd -k start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
[root@localhost ~]# ss -tnl|grep 80
LISTEN 0 128 :::80 :::*
[root@localhost ~]#
可以关闭掉mysql再测试:
[root@localhost htdocs]# service mysqld stop
Shutting down MySQL. [ OK ]
[root@localhost htdocs]#
11.编译Xcache
解包:
[root@localhost lamp]# tar xf xcache-3.2.0.tar.gz
执行phpize(phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块):
[root@localhost lamp]# cd xcache-3.2.0
[root@localhost xcache-3.2.0]# phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
编译:
[root@localhost xcache-3.2.0]# ./configure \
> --enable-xcache \ #开启cache功能
> --with-php-config=/usr/local/php/bin/php-config \ #指定php的配置程序,这个程序是告诉编译程序php的信息的
> && make && make install
编译后有一条信息,记录下来稍后会用到:
Installing shared extensions: /usr/local/php-5.5.3/lib/php/extensions/no-debug-zts-20121212/
复制xcache.ini到/etc/php.d目录:
[root@localhost xcache-3.2.0]# mkdir /etc/php.d
[root@localhost xcache-3.2.0]# cp xcache.ini /etc/php.d/
修改配置文件:
[root@localhost xcache-3.2.0]# vim /etc/php.d/xcache.ini
将:extension = xcache.so
修改为刚才编译完成后保留的位置:
extension = /usr/local/php-5.5.3/lib/php/extensions/no-debug-zts-20121212/xcache.so 12.测试Xcache的作用:
没启动Xcache:
[root@localhost php.d]# ab -c 10 -n 100 http://10.10.10.11/pma/index.php
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.10.10.11 (be patient).....done
Server Software: Apache
Server Hostname: 10.10.10.11
Server Port: 80
Document Path: /pma/index.php
Document Length: 9047 bytes
Concurrency Level: 10
Time taken for tests: 3.876 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 1037900 bytes
HTML transferred: 904700 bytes
Requests per second: 25.80 [#/sec] (mean)
Time per request: 387.550 [ms] (mean)
Time per request: 38.755 [ms] (mean, across all concurrent requests)
Transfer rate: 261.53 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 5.4 0 27
Processing: 290 383 25.3 387 438
Waiting: 272 356 25.3 360 409
Total: 308 385 24.5 388 438
Percentage of the requests served within a certain time (ms)
50% 388
66% 399
75% 401
80% 404
90% 412
95% 419
98% 430
99% 438
100% 438 (longest request) 启动Xcache:
[root@localhost php.d]# ab -c 10 -n 100 http://10.10.10.11/pma/index.php
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.10.10.11 (be patient).....done
Server Software: Apache
Server Hostname: 10.10.10.11
Server Port: 80
Document Path: /pma/index.php
Document Length: 9047 bytes
Concurrency Level: 10
Time taken for tests: 0.728 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 1037900 bytes
HTML transferred: 904700 bytes
Requests per second: 137.39 [#/sec] (mean)
Time per request: 72.784 [ms] (mean)
Time per request: 7.278 [ms] (mean, across all concurrent requests)
Transfer rate: 1392.57 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 5.0 0 25
Processing: 29 70 23.4 67 129
Waiting: 8 53 23.2 50 128
Total: 29 72 23.9 69 129
Percentage of the requests served within a certain time (ms)
50% 69
66% 80
75% 86
80% 95
90% 111
95% 117
98% 125
99% 129
100% 129 (longest request)