php配置XDebug,用phpstorm調試thinkphp5

判斷應該安裝XDebug的版本
  • xdebug官網檢測:

  • 根據提示下載並配置

    1. Download php_xdebug-2.9.5-7.2-vc15-x86_64.dll
    2. Move the downloaded file to D:\xampp\php\ext
    3. Edit D:\xampp\php\php.ini and add the line
      zend_extension = D:\xampp\php\ext\php_xdebug-2.9.5-7.2-vc15-x86_64.dll
    4. Restart the webserver
  • XDebug詳細配置

    ;指定xdebug庫文件的絕對路徑
    zend_extension = D:\xampp\php\ext\php_xdebug-2.9.5-7.2-vc15-x86_64.dll
    ;開啓遠程調試,連接和監聽主機和端口的調試客戶端
    xdebug.remote_enable = On
    ;啓用代碼自動跟蹤
    xdebug.auto_trace=On
    ;允許收集傳遞給函數的參數變量
    xdebug.collect_params=1
    ;允許收集函數調用的返回值
    xdebug.collect_return=On
    ;客戶機ip
    xdebug.remote_host="127.0.0.1"
    ;客戶機xdebug監聽端口和調試協議
    xdebug.remote_port=9000
    ;啓動調試器協議dbgp
    xdebug.remote_handler=dbgp
    ;指定DBGP調試器(IDE)處理程序區分大小寫
    xdebug.idekey="PHPSTORM"
    ;啓用性能檢測分析
    xdebug.profiler_enable = On
    ;關閉性能檢測分析觸發器
    xdebug.profiler_enable_trigger = off
    ;指定性能分析文件的存放目錄
    ;xdebug.profiler_output_dir = "d:\tmp"
    ;指定性能分析文件的名稱
    ;xdebug.profiler_output_name = cachegrind.out.%t.%p
    ;指定堆棧跟蹤文件的存放目錄
    ;xdebug.trace_output_dir="d:\tmp"
    ;指定堆棧跟蹤文件的名稱
    ;xdebug.trace_output_name = trace.%c
    
    
phpstorm配置,以TP5爲例
  • Create new project:add local server

    配置TP5根目錄提示沒有默認頁,勾選不檢查HTTP connection解決
    在這裏插入圖片描述

  • 繼續配置web path
    在這裏插入圖片描述

  • 配置解釋器
    在這裏插入圖片描述

  • 配置xdebug,主要是驗證debugger以及配置端口
    在這裏插入圖片描述

  • 配置phpstorm的Debug Servers
    在這裏插入圖片描述

  • 配置PHP Remote Debug
    在這裏插入圖片描述

  • 配置瀏覽器插件

    xdebug-helper-for-firefox

  • 斷點調試效果
    在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章