版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wyansai/article/details/81814395
PHP性能测试工具
安装
1、mongodb服务及扩展
- 使用pecl安装,需要php-dev和pcre服务
- sudo apt-get install mongodb
- sudo pecl install mongodb
- 编辑php.ini,添加extension=mongodb.so
2、xhprof扩展安装
- xhprof官方只支持到php5.4,所以采用tideways,是xhprof的提高版
- wget https://github.com/tideways/php-profiler-extension
- phpize
- ./configure
- make && make install
3、xhgui安装
- git clone https://github.com/maxincai/xhgui.git
- cd xhgui && php install.php
4、nginx配置
- 在项目的server配置中php解析配置里加入下列代码
目的是为了自动include “header.php”文件
fastcgi_param TIDEWAYS_SAMPLERATE "25";
fastcgi_param PHP_VALUE "auto_prepend_file=/www/xhgui/external/header.php";
- 为xhgui的web单独设置一个虚拟机
必须重置路由
location / {
try_files $uri $uri/ /index.php?$uri&$args;
}