VS Code PHP 没有 xdebug.remote_autostart=1 的调试

VS Code PHP Debugging without xdebug.remote_autostart=1

如何在 PHP.INI 中没有以下设置的情况下使用带有 VS Code 的 PHP 调试器?

xdebug.remote_autostart=1

此设置使 apache 非常慢。

在我使用 PHPStorm 之前,它提供了一个触发调试器的 URL 参数。我想知道这在 VS Code 中是否也可行。

我使用 VS Code 1.53.2 和来自 Felix Becker 的 PHP 扩展 pck。

在有人问之前:尽管我喜欢 PHPStorm,但我还是切换到了 VS 代码,因为 PHPStorm 由于性能不佳而无法在我的 Surface pro X 上使用。 VS Code 有一个 Windows Arm 实现!

使用 xdebug v3 而不是 v2:

对于 Xdebug v3.x.x:

[xdebug]
zend_extension = //path to xdebug dll file
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000

在 xdebug v3 中你可以使用 xdebug.start_with_request = yes 而不是 xdebug.remote_autostart = 1

make a simple test.php file, put a phpinfo(); statement in there, then copy the output and paste it into the Xdebug installation wizard. It will analyze it and give you tailored installation instructions for your environment.

如果您在“VS Code”中使用“Felix Becker”的“PHP Debug”扩展,您将在扩展的详细信息中看到更多说明。