• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

部署xhprof监控php效率

php 搞代码 3年前 (2022-01-23) 11次浏览 已收录 0个评论
文章目录[隐藏]

部署xhprof监控php效率

1、安装xhprof扩展

下载地址:https://pecl.php.net/package/xhprof

2、配置php.ini

[xhprof]extension=xhprof.soxhprof.output_dir=/tmp

3、下载web界面程序并部署
下载地址:https://github.com/phacility/xhprof
将apache或者nginx解析地址解析到xhprof_html目录

4、在你需要监控的页面或者应用中添加代码
a/页头添加如下代码

if (extension_loaded('xhprof')) {xhprof_enable();}

b/页尾添加如下代码

if (extension_loaded("xhprof")) {$xhprof_name = "test001";$XHPROF_ROOT = "/vagrant_data/xhprof";include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";include_once $XHPROF_ROOT . "/xhprof_<span>@本文来*源gaodai#ma#com搞*!代#%^码$网*</span><textarea>搞gaodaima代码</textarea>lib/utils/xhprof_runs.php";$xhprof_data = xhprof_disable();$xhprof_runs = new XHProfRuns_Default();$run_id = $xhprof_runs->save_run($xhprof_data, $xhprof_name);echo "---------------\n"."Assuming you have set up the http based UI for \n"."XHProf at some address, you can view run at \n"."http://192.168.33.10:9998/index.php?run=$run_id&source=xhprof_foo\n"."---------------\n";}

5、访问解析到xhprof的url


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:部署xhprof监控php效率
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址