# make -j 8
出现Build complete. 那么,恭喜编译成功
# make install
以下这些提示,按需。
Wrote PEAR system config file at: /usr/local/php-5.6.34/etc/pear.conf
You may want to add: /usr/local/php-5.6.34/lib/php to your php.ini include_path
/app/httpd/php-5.6.34/build/shtool install -c ext/phar/phar.phar /usr/local/php-5.6.34/bin
ln -s -f phar.phar /usr/local/php-5.6.34/bin/phar
Installing PDO headers: /usr/local/php-5.6.34/include/php/ext/pdo/
#ss -nlt
fcgi正在监听端口
State Recv-Q Send-Q Local Address:Port
LISTEN 0 128 127.0.0.1:9000
编辑一个php的测试文件
#vim /app/www/virtualhost/index.php
<?php
phpinfo();
?>
11.连接数据库测试
在mysql中创建一个用于连接的账户
mysql> create user test@'192.168.5.102' identified by 'password';
mysql5.7数据库下已经没有password这个字段了,password字段改成了authentication_string
并且密码策略控制着密码相关
以下为修改默认的密码策略,0=LOW,至少8个字符
mysql> set global validate_password_policy=0
测试代码如下:
# vim /app/www/virtualhost/check.php
<?php
$mysqli = new mysqli("localhost", "test", "12345678");
/* check connection */
if ($mysqli->connect_errno) {
echo "连接失败";
exit();
}
echo "连接成功";
/* close connection */
$mysqli->close();
?>
# curl www.hunk.tech/check.php
连接成功
以下代码为判断mysql和mysqli扩展是否安装
<?php
function mysqlinstalled (){
if (function_exists ("mysql_connect")){
return true;
} else {
return false;
}
}
function mysqliinstalled (){
if (function_exists ("mysqli_connect")){
return true;
} else {
return false;
}
}
if (mysqlinstalled()){
echo "<p>The mysql extension is installed.</p>";
} else {
echo "<p>The mysql extension is not installed..</p>";
}
if (mysqliinstalled()){
echo "<p>The mysqli extension is installed.</p>";
} else {
echo "<p>The mysqli extension is not installed..</p>";
}
?>
12.测试未启用加速器前的性能
#ab -c 1000 -n 5000 192.168.5.102/check.php
Server Software: Apache/2.4.29
Server Hostname: 192.168.5.102
Server Port: 80
Document Path: /check.php
Document Length: 12 bytes
Concurrency Level: 1000
Time taken for tests: 6.751 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 915000 bytes
HTML transferred: 60000 bytes
Requests per second: 740.59 [#/sec] (mean)
Time per request: 1350.282 [ms] (mean)
Time per request: 1.350 [ms] (mean, across all concurrent requests)
Transfer rate: 132.35 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 210 625.4 1 3019
Processing: 1 436 954.0 190 6676
Waiting: 1 435 954.0 189 6675
Total: 63 645 1295.6 194 6734
Percentage of the requests served within a certain time (ms)
50% 194
66% 215
75% 335
80% 405
90% 1341
95% 3439
98% 6299
99% 6697
100% 6734 (longest request)
#vim /etc/php.d/xcache.ini
xcache.optimizer = On
xcache.size = 1024M
#ab -c 1000 -n 5000 192.168.5.102/check.php
Server Software: Apache/2.4.29
Server Hostname: 192.168.5.102
Server Port: 80
Document Path: /check.php
Document Length: 12 bytes
Concurrency Level: 1000
Time taken for tests: 6.541 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 915000 bytes
HTML transferred: 60000 bytes
Requests per second: 764.46 [#/sec] (mean)
Time per request: 1308.116 [ms] (mean)
Time per request: 1.308 [ms] (mean, across all concurrent requests)
Transfer rate: 136.62 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 277 612.3 2 3017
Processing: 1 425 835.1 156 4186
Waiting: 1 424 835.1 155 4185
Total: 61 702 1187.2 167 5262
Percentage of the requests served within a certain time (ms)
50% 167
66% 235
75% 436
80% 1021
90% 2137
95% 3817
98% 5138
99% 5197
100% 5262 (longest request)