一、安装查看是否是否安装xhprof扩展

php --ri xhprof #检查php是否有这个扩展

二、xhprof扩展的安装

$ wget http://pecl.php.net/get/xhprof-0.9.4.tgz  
$ tar -zxvf xhprof-0.9.4.tgz 
$ cd xhprof-0.9.4
$ cd extension/
$ phpize  -----------》phpize: command not found 解决 :yum install php-devel(注意:phpize 生成configure文件的)
$./configure --with-php-config=/usr/local/php/bin/php-config
$ make
$ make install

三、配置 php.ini


  1. [xhprof]
  2. extension=xhprof.so;
  3. ; directory used by default implementation of the iXHProfRuns
  4. ; interface (namely, the XHProfRuns_Default class) for storing
  5. ; XHProf runs.
  6. ;
  7. ;xhprof.output_dir=<directory_for_storing_xhprof_runs>
  8. xhprof.output_dir=/tmp/xhprof

四、重启php-fpm或httpd服务

五、测试以及访问方式


把安装目录的文件夹拷贝到测试目录下

cp -Rf ./xhprof-0.9.4 /var/www/htm/

mv xhprof-0.9.4 xhprof #重命名文件


例子:

xhprof 安装使用及相关问题

第一种方式:复制上面到运行的结果(http路径),再次放入浏览器,填好前面对应的域名:

http://192.168.0.109/xhprof/xhprof_html/index.php?run=5af543f2115f8&source=xhprof_foo

xhprof 安装使用及相关问题


如果查看图形化展示 : yum install graphviz

xhprof 安装使用及相关问题



相关文章: