我在 Mac 上使用 PhpStorm。我正在尝试在远程 Ubuntu 服务器上的 Sail 容器中调试 Laravel 应用程序。
我可以从 Sail 容器内的 Xdebug 看到的错误是:
[17] Log opened at 2021-09-26 21:24:59.590599
[17] [Step Debug] INFO: Checking remote connect back address.
[17] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[17] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 89.164.145.129:9003.
[17] [Step Debug] WARN: Could not connect to client host discovered through HTTP headers, connecting to configured address/port: host.docker.internal:9003. :-|
[17] [Step Debug] INFO: Connected to debugging client: XXX.XXX.XXX.XXX:9003 (from HTTP_X_FORWARDED_FOR HTTP header), host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port). :-)
[17] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/server.php" language="PHP" xdebug:language_version="8.0.5" protocol_version="1.0" appid="17" idekey="phpstorm"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[17] [Step Debug] WARN: 2021-09-26 21:24:59.896494: There was a problem sending 179 bytes on socket 10: Broken pipe.
[17] Log closed at 2021-09-26 21:24:59.898408
我已经设置了服务器、SSH 隧道、自动文件部署、Xdebug,并在 PhpStorm 中进行了验证,但我一直收到此错误。
问题是 PhpStorm 正在侦听调试连接,但没有检索到,调试未在 IDE 中触发。