它停止在xdebug版本3中工作


介绍

这是新的一年,因此在重建开发环境Docker之后,我无法逐步使用xdebug。
当我查找它时,这是因为在xdebug的版本3中更改了设置项目名称,因此先前的设置无效。

TL; DR

使用以下设置。
顺便说一句,调试器的备用端口(IDE = phpstorm,vscode)必须设置为9003。

1
2
3
4
5
6
7
xdebug.log=/tmp/xdebug.log
xdebug.mode=develop, debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=9003

zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so

v2时代设定

也许您可以在Internet上找到这些设置。这是版本2之前的设置。

1
2
3
4
5
6
7
8
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_port=9003
xdebug.remote_host="host.docker.internal"
xdebug.remote_connect_back = 0
xdebug.remote_log=/tmp/xdebug.log

zend_extension=xdebug.so

如何检查xdebug的版本

如果

php -v,它将显示为with Xdebug v3.0.2

1
2
3
4
5
6
root@57b67435355c:/# php -v
Cannot load Xdebug - it was already loaded
PHP 7.2.33 (cli) (built: Sep 10 2020 15:18:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans

操作检查(phpstorm)

由于使用了

phpstorm,因此有必要检查xdebug的操作。
下图中箭头所示的调试端口最初写为9000, 90003,但是执行③的验证时,由于指示将其设置为9003而对其进行了更改。 ..

2021-01-07_10h40_09.png

图像中,警告xdebug.mode不是调试,但是在官方文档中,似乎多个设置如下所示是有效的。实际上,可以进行。

2021-01-07_10h44_56.png

参考文献

  • https://xdebug.org/

我认为这是官方网站。 .. .. ..