如何将 Xdebug 3 连接到 Windows 10 上的 PhpStorm?

How can I connect Xdebug 3 to PhpStorm on Windows 10?

我正在尝试连接 PhpStorm 并使用 Xdebug 调试 PHP scripts/webpages,我已经做过好几次了。

这是我的 php.ini 文件(有趣的一点):

[xdebug]
zend_extension=C:\xampp\php\ext\php_xdebug.dll
xdebug.remote_enable=1
xdebug.remote_port=10000
xdebug.remote_mode=req

我设置了多个断点并在我的索引上调用了 xdebug_break(),但代码执行并没有在它们处停止。

这是 Xdebug 的 PhpStorm 验证脚本输出:

netstat 的输出显示 PhpStorm 正在侦听端口 10000:

将 php.ini 中的行更改为

xdebug.mode=debug

并将 PhpStorm 上的端口设置为侦听 9003 而不是 9000。

在 xdebug v3 中,默认 xdebug 端口更改为 9003: https://xdebug.org/docs/upgrade_guide#Step-Debugging

改变

来自

xdebug.remote_enable=1
xdebug.remote_port=10000
xdebug.remote_mode=req

进入

xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_port=10000