简体   繁体   English

Xdebug 问题:连接到客户端超时(等待:200 毫秒)。 :-(

[英]Xdebug Problem: Time-out connecting to client (waited: 200 ms). :-(

I am keep getting this error in Xdebug log:我在 Xdebug 日志中不断收到此错误:

Time-out connecting to client (Waited: 200 ms).连接到客户端超时(等待:200 毫秒)。 :-( :-(

And debugger in PhpStorm is not working at all.而且 PhpStorm 中的调试器根本不工作。

$ php -v
PHP 7.3.21 (cli) (built: Aug  4 2020 11:21:19) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.21, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans

My PHP Ini:我的 PHP Ini:

[xdebug]
zend_extension=".../php_xdebug-2.9.6-7.3-vc15-x86_64.dll"
xdebug.profiler_append=0
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_dir = ".../tmp"
xdebug.profiler_output_name = "xdebug_profile.%R::%u"
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_mode=req
xdebug.remote_port=9001
xdebug.auto_trace=1
xdebug.collect_includes=1
xdebug.collect_params=1
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
xdebug.remote_log=".../logs/xdebug.log"
;xdebug.remote_connect_back=1

Log out:登出:

==> xdebug.log <==
[17080] Log opened at 2021-02-18 20:10:25
[17080] I: Connecting to configured address/port: 127.0.0.1:9001.
[17080] E: Time-out connecting to client (Waited: 200 ms). :-(
[17080] Log closed at 2021-02-18 20:10:25

PhpStorm Debug Settings: PhpStorm 调试设置:
设置

In search, I got to the point that something was blocking the request from the docker to the local machine on port 9000 9003. In the end, I solved the problem by adding new 2 rules to the ubuntu ufw firewall and it all worked.在搜索中,我发现有东西阻止了从 docker 到端口 9000 9003 上的本地计算机的请求。最后,我通过向 ubuntu ufw 防火墙添加新的 2 条规则解决了这个问题,一切正常。

sudo ufw allow in from 172.16.0.0/12 to any port 9000 comment xDebug9000
sudo ufw allow in from 172.16.0.0/12 to any port 9003 comment xDebug9003

Specifically, you need to open port 9001. As in the examples above.具体来说,需要打开 9001 端口。如上例所示。 Also, instead of localhost in xdebug.client_host, I specified my IP on the local network.此外,我在本地网络上指定了我的 IP,而不是 xdebug.client_host 中的 localhost。

Address:   172.16.0.0            10101100.0001 0000.00000000.00000000
Netmask:   255.240.0.0 = 12      11111111.1111 0000.00000000.00000000
Wildcard:  0.15.255.255          00000000.0000 1111.11111111.11111111
=>
Network:   172.16.0.0/12         10101100.0001 0000.00000000.00000000 (Class B)
Broadcast: 172.31.255.255        10101100.0001 1111.11111111.11111111
HostMin:   172.16.0.1            10101100.0001 0000.00000000.00000001
HostMax:   172.31.255.254        10101100.0001 1111.11111111.11111110
Hosts/Net: 1048574               (Private Internet)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM