在 VS Code 上使用 XDEBUG_TRIGGER env 时 Xdebug 未启动

发布于 2025-01-17 08:53:26 字数 1643 浏览 0 评论 0原文

我正在使用VS代码配置Xdebug,当我使用start_with_request =触发设置时,它不起作用。 如果我将配置值设置为它可以工作。 我认为vs代码不是从aumain.json文件发送ENV变量。

我的Xdebug ini文件:

zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request = trigger

我的auginn.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "env": {
                "XDEBUG_TRIGGER": "true"
            }
        }
    ]
}

我在Ubuntu VM和Windows 10上使用Microsoft Remote-SSH扩展名的VSCODE。 我的Xdebug扩展名是Xdebug官方扩展。

来自Xdebug的日志:

[2393] Log opened at 2022-03-29 13:54:04.173262
[2393] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[2393] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[2393] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[2393] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[2393] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[2393] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[2393] Log closed at 2022-03-29 13:54:04.360936

I'm configuring Xdebug in VS Code and it doesn't work when I use the start_with_request=trigger setting.
If I set the config value to yes it works.
I think VS Code is not sending the env variables from the launch.json file.

My Xdebug ini file:

zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request = trigger

My launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "env": {
                "XDEBUG_TRIGGER": "true"
            }
        }
    ]
}

I use VSCode with Microsoft Remote-SSH extension on a Ubuntu VM and Windows 10.
My Xdebug extension is the XDebug official extension.

Log from Xdebug:

[2393] Log opened at 2022-03-29 13:54:04.173262
[2393] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[2393] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[2393] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[2393] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[2393] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[2393] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[2393] Log closed at 2022-03-29 13:54:04.360936

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终弃我 2025-01-24 08:53:26

vscode-php-debug dev此处。

这是一个普遍的误解。提供的启动。JSON仅听XDEBUG/DBGP连接 - 默认名称所暗示。如果其中还有程序设置,则VS代码也将启动(PHP)进程。只有在这种情况下,VS代码才能为新启动过程的环境做出贡献。

因此,假设您正在运行Web服务器,则只能通过修改php.ini或以某种方式更改该Web服务器进程的过程环境来更改XDEBUG设置...

您也可以查看其他启动。代码>狙击手在当前摘要末尾键入php。也许其中一些可能有用。

如果某人设置env没有设置程序 ...

vscode-php-debug dev here.

This is a common misunderstanding. The provided launch.json only listens for Xdebug/DBGp connections - as the default name implies. If there was also a program setting in there, VS Code would also start a (php) process. And only in that case could VS Code contribute to the environment of that newly started process.

So, assuming you are running a web server, you can only change Xdebug settings by modifying the php.ini or somehow change the process environment of that web server process...

You can also check out other launch.json snippers by typing php at the end of the current snippet. Maybe some of them could be useful.

Perhaps I should add a warning if somebody sets env without setting program...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文