# 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.测试未启用Zend OPcach加速器前的性能
#ab -c 1000 -n 1000 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: 1.381 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 183000 bytes
HTML transferred: 12000 bytes
Requests per second: 724.01 [#/sec] (mean)
Time per request: 1381.202 [ms] (mean)
Time per request: 1.381 [ms] (mean, across all concurrent requests)
Transfer rate: 129.39 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 239 424.4 2 1032
Processing: 9 154 107.5 141 796
Waiting: 4 154 107.7 140 795
Total: 52 393 445.2 149 1324
Percentage of the requests served within a certain time (ms)
50% 149
66% 165
75% 421
80% 1055
90% 1213
95% 1290
98% 1312
99% 1319
100% 1324 (longest request)
#ab -c 1000 -n 1000 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: 1.262 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 183183 bytes
HTML transferred: 12012 bytes
Requests per second: 792.66 [#/sec] (mean)
Time per request: 1261.572 [ms] (mean)
Time per request: 1.262 [ms] (mean, across all concurrent requests)
Transfer rate: 141.80 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 163 352.8 9 1040
Processing: 24 227 195.6 192 797
Waiting: 3 226 195.7 191 797
Total: 70 390 360.5 205 1200
Percentage of the requests served within a certain time (ms)
50% 205
66% 219
75% 487
80% 818
90% 1107
95% 1151
98% 1189
99% 1196
100% 1200 (longest request)