部署xhprof监控php效率(linux版本)
生活随笔
收集整理的這篇文章主要介紹了
部署xhprof监控php效率(linux版本)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
部署xhprof監(jiān)控php效率
2015年5月26日?| 標(biāo)簽:?php,?監(jiān)控1、安裝xhprof擴(kuò)展
下載地址:https://pecl.php.net/package/xhprof
2、配置php.ini
| 1 2 3 | [xhprof] extension=xhprof.so xhprof.output_dir=/tmp |
3、下載web界面程序并部署
下載地址:https://github.com/phacility/xhprof
將apache或者nginx解析地址解析到xhprof_html目錄
4、在你需要監(jiān)控的頁面或者應(yīng)用中添加代碼
a/頁頭添加如下代碼
| 1 2 3 | if(extension_loaded('xhprof')) { ????xhprof_enable(); } |
b/頁尾添加如下代碼
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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_lib/utils/xhprof_runs.php"; ?????$xhprof_data= xhprof_disable(); ?????$xhprof_runs= newXHProfRuns_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
?
來源:http://www.phpno.com/php-xhprof.html
總結(jié)
以上是生活随笔為你收集整理的部署xhprof监控php效率(linux版本)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 多大可以开通银行卡
- 下一篇: 家庭养殖致富项目 就在老家干一年十几万