简体   繁体   English

在远程主机上运行的Xdebug:无法连接回客户端->超时

[英]Xdebug running on remote host: cannot connect back to client -> timeout

Since two days I try to get my Xdebug configuration running without success what drives me crazy! 自从两天以来,我一直试图使我的Xdebug配置无法成功运行,这使我发疯!

My setup 我的设定

Client: Macbook Pro with PhpStorm 客户端:Macbook Pro与PhpStorm

Xdebug is running on a remote server ( Ubuntu 18.04 ) in a Docker ( latest stable version ) container behind the jwilder/nginx proxy. Xdebug在jwilder / nginx代理后面的Docker(最新稳定版本)容器中的远程服务器(Ubuntu 18.04)上运行。

Xdebug runs on PHP 7.3.9, Xdebug version is 2.7.2 Xdebug在PHP 7.3.9上运行,Xdebug版本为2.7.2

Xdebug Settings: Xdebug设置:

xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remode_mode=req
xdebug.remote_handler=dbgp
xdebug.remote_port=10000
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
xdebug.remote_log=/var/log/xdebug.log

The xdebug.remote_host is docker.host.internal because I copied my config file from my local xdebug.ini. xdebug.remote_hostdocker.host.internal因为我从本地xdebug.ini复制了配置文件。 On Mac you use this value. 在Mac上,您可以使用此值。 In this case xdebug.remote_host will be ignored because xdebug.remote_connect_back is on. 在这种情况下, xdebug.remote_host将被忽略,因为xdebug.remote_connect_back已打开。

This is the phpinfo page (too big to display an actual image here). 这是phpinfo页面(太大而无法在此处显示实际图像)。

phpinfo phpinfo

This is the output in my xdebug log file 这是我的xdebug日志文件中的输出

[17] Log opened at 2019-09-07 07:40:29
[17] I: Checking remote connect back address.
[17] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[17] I: Remote address found, connecting to 178.203.235.46:10000.
[17] E: Time-out connecting to client (Waited: 200 ms). :-(
[17] Log closed at 2019-09-07 07:40:29

This is my remote Xdebug validation in PhpStorm: 这是我在PhpStorm中进行的远程Xdebug验证:

PhpStorm中的Xdebug验证

Its seems like everything should run: PhpStorm is setup correctly ( listening on port 10000 ) - but its not!!! 似乎一切都应该运行:PhpStorm已正确设置(侦听端口10000)-但事实并非如此!

What have i tried: almost everything. 我尝试了什么:几乎所有东西。 I used older Xdebug versions, other PHP versions... nothing. 我使用了较旧的Xdebug版本,其他的PHP版本……什么也没有。 Always the timeout when Xdebug wants to connect to my client. Xdebug想要连接到我的客户端时总是超时。

Also I disabled xdebug.remote_connect_back and used the HTTP_X_REAL_IP as xdebug.remote_host --> timeout. 另外,我禁用了xdebug.remote_connect_back并将HTTP_X_REAL_IP用作xdebug.remote_host->超时。

Then I thought maybe its the nginx proxy. 然后我想也许它是Nginx代理。 So I tried it without it -> same error: timeout. 所以我尝试了没有它->同样的错误:超时。

What am I doing wrong? 我究竟做错了什么?

I wrote this post a couple of years ago which might be helpful: https://medium.com/@pavlakis/setting-up-xdebug-with-docker-and-php-7-2-f5a6553cb956 我几年前写了这篇文章,可能会有所帮助: https : //medium.com/@pavlakis/setting-up-xdebug-with-docker-and-php-7-2-f5a6553cb956

In case the proxy you're using is giving you a different IP, try the following: https://github.com/phpminds/website/blob/master/docker.sh 如果您使用的代理为您提供了不同的IP,请尝试以下操作: https : //github.com/phpminds/website/blob/master/docker.sh

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

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