xhprof是facebook开源出来的一个php性能测试工具,在facebook开发过程当中被普遍应用。 php
1、xhprof的安装网站推广html
1.下载地址:http: //pecl.php.net/get/xhprof-0.9.2.tgz linux
在linux下,执行命令:wget http: //pecl.php.net/get/xhprof-0.9.2.tgz web
2.因为xpprof自带有一个web分析页面,所以能够把它放在web服务器目录下浏览器
mv xhprof-0.9.2.tgz /www/webroot/服务器
cd /www/webroot/php-fpm
3. 解压缩:tar xzf xhprof-0.9.2.tgz ,获得解压缩后的文件xhprof-0.9.2工具
cd xhprof-0.9.2性能
进入文件,能够看到xhprof的目录结构 :测试
CHANGELOG
CREDITS
examples
extension
LICENSE
README
xhprof_html
xhprof_lib
对一个软件不是很了解,最好的办法是打开README文件,看个究竟。
vi README
嚓!For installation and usage notes refer to:
xhprof_html/docs/index.html
那咱们只好打开 xhprof_html/docs/index.html这个文件了(我刚才把整个xhprof放在web服务器目录下,所以能够在浏览器下直接打开)。该文件下有详细关于xhprof的介绍,下面重点介绍安装步骤:
The steps below should work for Linux/Unix environments.
% cd <xhprof_source_directory>/extension/ % phpize % ./configure --with-php-config=<path to php-config> % make % make install % make test
4.按照上面说明安装
A. cd extension/ //进入目录
B. ~/web/php/bin/phpize //phpize是用来扩展php扩展模块的,在php安装目录的bin下
C. ./configure --enable-xhprof --with-php-config=~/web/php/bin/php-config
D. make&make install
上述步骤执行完毕,会生成.so文件
5.配置php.ini
在php.ini中配置xhprof扩展,打开php.ini,在文件尾部添加:
[xhprof] extension=xhprof.so xhprof.output_dir=<directory_for_storing_xhprof_runs> //能够本身定义输出文件目录
注意:xhprofy存放的目录要和php.ini中extension_dir指向的目录一致。
6. 从新启动php网站推广
~/web/php/sbin/php-fpm reload
在phpinfo信息中便可看到xhprof扩展安装成功。
具体对xhprof的使用,能够参考xhprof安装目录下的/xhprof_html/docs/index.html,里面有详细的使用说明(fblww-0116)