网站制作学习网Linux→正文:mac xhprof 安装
字体:

mac xhprof 安装

Linux 2016/10/21 18:18:53  点击:不统计

<网f站o学a习s制p作.cn>
 mac怎么安装php性能测试工具xhprof ,更linux安装基本一致,采用phpize扩展安装

首先 下载xhprof地址 

https://pecl.php.net/package/xhprof

选择自己对应的版本

下载后,解压,然后进入目录,再进入extension 

 

找到自己的phpize

>whereis phpize

>/usr/bin/php/phpize

运行phpize

然后 找到php-config

运行

./configure —with-php-config-/usr/bin/php-config

然后make && make install

 

安装完毕后一定在php.ini 中新增加对应的扩展

extension = xhprof.so

重启 php-fpm 查看phpinfo();就可以看到扩展了。

怎么使用直接上代码


$XHPROF_ROOT = "/usr/local/xhprof/xhprof_lib/utils/";//这里是本地xhprof 源文件地址

function a($num){
$num-- ;
if($num > 0 )a($num);
return ;
}
xhprof_enable();

a(100);
$xhprof_data = xhprof_disable();

include_once $XHPROF_ROOT . "xhprof_lib.php";

include_once $XHPROF_ROOT . "xhprof_runs.php";
$xhprof_runs = new XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_foo");

echo "---------------\n".
"Assuming you have set up the http based UI for \n".
"XHProf at some address, you can view run at \n".
" http://www.xhprof.com/index.php?run=$run_id&source=xhprof_foo\n".
"---------------\n";//自定义的显示地址,都在 下载的原文件夹内。

http://%77%77%77%2E%66网站制作%6F学习网%72%61%73%70%2E%63%6E

·上一篇:oh my zsh 安装与更新 >>    ·下一篇: warning: Insecure world writable dir >>
推荐文章
最新文章