Phpstorm&Docker&Xdebug調(diào)試

1.利用docker構(gòu)建dnmp環(huán)境,

大家可以參考這個進行構(gòu)建 傳送門

docker-compose up -d 之前,在php.ini中 Xdebug 配置如下

[XDebug]
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
; Set to host.docker.internal on Mac and Windows, otherwise, set to host real ip
xdebug.remote_host = docker.for.mac.localhost
xdebug.remote_port = 9999
xdebug.remote_log = /var/log/php/xdebug.log
xdebug.idekey = phpstorm

2.查看phpinfo

重點看這幾個參數(shù)
Directive             Local Value               Master Value
xdebug.idekey         phpstorm                  phpstorm
xdebug.remote_port    9999                      9999
xdebug.remote_host    docker.for.mac.localhost  docker.for.mac.localhost
xdebug.remote_log     /var/log/php/xdebug.log   /var/log/php/xdebug.log

3.配置phpstorm

3.1配置PHP環(huán)境
1.進入Langusges&Frameworks>PHP
image.png
2.進入CLI Interpreter選擇PHP
image.png
3. 進入Docker Server選擇進行連接Docker
image.png

務必是Connection successful狀態(tài)

3.2 Debug相關(guān)

1.Debug端口配置
image.png
2.配置Servers
image.png
3.Run -> Edit Configuration 或者 或者點擊 PHPstorm 右上角的 Edit Configuration
image.png

4.開始調(diào)試

開啟Debug模式
image.png
請求項目
image.png
查看Debug信息
image.png

周末在家記錄一下,希望可以幫助到你,成就別人,成就自己

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內(nèi)容