我有一个PHP-FPM docker容器(PHP 7.2),其中有一个公开REST API的服务,容器中安装了xdebug 2.6。这是xdebug配置:
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.remote_autostart=0
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_host=hostmachine
现在,我还在docker主机上安装了xdebug,这是我的桌面。我正试图在docker主机上调试一个API客户端。客户端连接到公开API的容器。从API客户端向容器发送请求后,所有内容都会挂起。
在下面的代码示例中
$test=1
如果我的IDE正在侦听传入的调试器连接(未选择调试配置),则永远不会执行,在进入
$response = $this->httpClient->get('info')
(
$httpClient
是guzzle http 6.3 btw):
public function getInfo(): InfoInterface
{
$response = $this->httpClient->get('info');
$test = 1;
}
我认为容器中的xdebug正在尝试连接到我的IDE,这就是挂起的原因。但是,如何在没有容器的xdebug干扰的情况下调试API客户机呢?