簡體   English   中英

Xdebug 無法連接到調試客戶端。 試過:本地主機:9000

[英]Xdebug Could not connect to debugging client. Tried: localhost:9000

我在 Xdebug v2 之前使用過,但在上次更新后我遇到了 Xdebug v3.0.0,我替換了更新用戶指南所需的所有內容

我正在使用 Docker。

我的調試配置

#xdebug.remote_enable=true
xdebug.mode=debug

#xdebug.remote_port=9000
xdebug.client_port=9000

xdebug.remote_host=172.17.0.1

xdebug.remote_handler=dbgp

#xdebug.remote_autostart=1
xdebug.start_with_request=yes

#xdebug.remote_connect_back=0
xdebug.discover_client_host=0

xdebug.idekey=PHPSTORM
xdebug.show_error_trace = 1
xdebug.max_nesting_level=250
xdebug.var_display_max_depth=10
#xdebug.remote_mode=req

xdebug.remote_log=/var/log/r_xdebug.log
xdebug.log=/var/log/xdebug.log

以及嘗試執行任何 PHP 腳本時我在日志中得到的內容:

tail -f /var/log/xdebug.log
[888] Log opened at 2020-11-29 10:39:51.670762
[888] [Step Debug] INFO: Connecting to configured address/port: localhost:9000.
[888] [Step Debug] WARN: Creating socket for 'localhost:9000', poll success, but error: Operation now in progress (29).
[888] [Step Debug] WARN: Creating socket for 'localhost:9000', connect: Cannot assign requested address.
[888] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(
[888] Log closed at 2020-11-29 10:39:57.515970

當我嘗試在瀏覽器中執行 URL 時,PhpStorm 沒有啟動調試器,但我檢查了

lsof -i :9000 | grep LISTEN

當我在 PhpStorm 中單擊監聽時出現監聽端口。 我的 conf 是同步File | Settings | Languages & Frameworks | PHP | Debug File | Settings | Languages & Frameworks | PHP | Debug File | Settings | Languages & Frameworks | PHP | Debug -> 調試端口 9000

我的 Xdebug 配置有什么問題以及我需要做什么?

我只想分享我是如何從 2.x 遷移到 3.x

;Xdebug 2.X
;xdebug.remote_enable=true
;xdebug.remote_port=9000
;xdebug.remote_host=172.17.0.1
;
;xdebug.remote_autostart=1
;xdebug.remote_connect_back=0
;xdebug.idekey=PHPSTORM
;xdebug.show_error_trace = 1
;xdebug.max_nesting_level=250
;xdebug.var_display_max_depth=10
;xdebug.remote_mode=req


;Xdebug 3.X
xdebug.mode=debug
xdebug.client_port=9000
xdebug.client_host=172.17.0.1
xdebug.remote_handler=dbgp
xdebug.start_with_request=yes
xdebug.discover_client_host=0
xdebug.idekey=PHPSTORM
xdebug.show_error_trace = 1
xdebug.max_nesting_level=250
xdebug.var_display_max_depth=10
xdebug.log=/var/log/xdebug.log

請將您的xdebug文件更新為:

xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.discover_client_host=1

我發現使用

xdebug.log_level=0

停止了多余的日志。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM