安裝php xdebug調試工具及性能分析工具webgrind for windows php
第一步:查看php版本等信息git
phpinfo();github
上面是 x86 NTS VC14web
第二步: 下載xdebugwindows
官網 https://xdebug.org/ 數組
第三步:
服務器
下載擴展, 放入php的/ext 擴展目錄app
第四步: php.ini 開啓擴展函數
配置其它選項:工具
[Xdebug]
;指定Xdebug擴展文件的絕對路徑
zend_extension="C:\App\php\php\php-7.0.12-nts\ext\php_xdebug-2.7.0alpha1-7.0-vc14-nts.dll"
;最大循環或調試次數,防止死循環
xdebug.max_nesting_level=50
;啓用性能檢測分析
xdebug.profiler_enable=On
;啓用代碼自動跟蹤
xdebug.auto_trace=on
;容許收集傳遞給函數的參數變量
xdebug.collect_params=On
;容許收集函數調用的返回值
xdebug.collect_return=On
;指定堆棧跟蹤文件的存放目錄
xdebug.trace_output_dir="C:\App\php\debug"
;指定性能分析文件的存放目錄
xdebug.profiler_output_dir="C:\App\php\debug"
;追加
xdebug.profiler_append=1
;指定追蹤文件名格式
;xdebug.profiler_output_name = "cachegrind.out.%c"
xdebug.profiler_output_name = "cachegrind.out.%s"
;遠程調試是否開啓
xdebug.remote_enable = On
;端口
xdebug.remote_port=9000
;遠程調試地址
xdebug.remote_host = 127.0.0.1
;數組或對象最大層數 最大可設置1023
xdebug.var_display_max_depth = 10
;將require,include相關載入的文件名寫入追蹤文件
xdebug.collect_includes=1
;堆棧追蹤
xdebug.default_enable=1
;打印請求方式
xdebug.dump.SERVER=REQUEST_METHOD
;打印GET請求參數
xdebug.dump.GET=*
;打印POST請求參數
xdebug.dump.POST=*
;打印COOKIE
;xdebug.dump.COOKIE=*
;打印UA
;xdebug.dump.SERVER=HTTP_USER_AGENT
配置好重啓服務器
第五步: 使用
接下來使用xdebug的日誌分析工具分析
xdebug 日誌分析工具 webgrind v1.5
下載地址: https://github.com/jokkedk/webgrind
下載後若是是壓縮包解壓後 , 如圖所示
打開config.php 配置
static $storageDir = 'C:/App/php/debug'; // 配置爲xdebug xdebug.profiler_output_dir 所指的目錄
運行測試代碼後, 訪問webgrind的入口, 查看
/END