我想试一试Xdebug 3.0.0RC1来探索什么已经改变了,以及它带来的新特性。我还使用了最新的PhpStorm 2020.3 EAP,它支持Xdebug 3,不需要任何主要配置。下面是调试器的PhpStorm配置:
下面是我为Xdebug3尝试过的配置:
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal # here I tried several combinations like: "localhost", "127.0.0.1", "172.17.0.1"
xdebug.client_port=9001 # here I tried several ports 9003 included with no success
我也尝试过完全不添加client_host/client_port
设置,但仍然失败。
我得到了这个错误:
Script php bin/console doctrine:cache:clear-metadata returned with error code 255
!! [17-Nov-2020 15:24:40 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9001 (through xdebug.client_host/xdebug.client_port) :-(
!! [17-Nov-2020 15:24:41 UTC] PHP Fatal error: Method class@anonymous::__toString() must not throw an exception, caught Symfony\Component\DependencyInjection\Exception\AutowiringFailedException: in /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php on line 233
关于我的环境的一些信息:
这很奇怪(因为我正在使用的Docker版本“不支持”host.docker.internal
,但它仍然有效),同时也奇怪的是,即使调试器一直在监听传入的连接,以下的配置也适用于Xdebug 2:
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9000
我在这里错过了什么?
注意:我已经应用了Xdebug 这里提供的解决方案。
发布于 2022-10-02 04:13:43
如果我正在使用CLI,我也会遇到同样的问题:
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
这是我的配置,它会导致警告消息:
[XDebug]
...
xdebug.mode=develop,debug
xdebug.discover_client_host=1
xdebug.start_with_request = yes
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9003
我使用配置从URL进行调试,URL使用的是FPM,而且运行良好。
但是,如果我使用的是CLI,则必须更改配置,特别是xdebug.start_with_request
以前(FPM):
xdebug.start_with_request =是
之后(CLI):
xdebug.start_with_request =触发器
作为附加信息,我使用的是Xdebug 3。
https://stackoverflow.com/questions/64878376
复制相似问题