【问题标题】:VS Code PHP Debugging without xdebug.remote_autostart=1没有 xdebug.remote_autostart=1 的 VS Code PHP 调试
【发布时间】:2021-05-17 21:31:15
【问题描述】:

如果没有在 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 实现!

【问题讨论】:

    标签: php apache visual-studio-code


    【解决方案1】:

    使用 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

    制作一个简单的test.php 文件,在里面放一个phpinfo(); 语句, 然后复制输出并将其粘贴到Xdebug installation wizard。它将对其进行分析并为您提供量身定制的安装 适用于您的环境的说明。

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

    【讨论】:

    • 谢谢,这很有帮助。使用 V3 设置进行调试要快得多。
    • 在我的 Surface pro X 上,由于 ARM、VS Studio、Apache 和 PHP 上的 x86 仿真,任何 JAVA 应用程序都非常慢,再次感谢!
    猜你喜欢
    • 2018-07-22
    • 1970-01-01
    • 2023-03-10
    • 2017-01-27
    • 2020-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多