在 VS Code 上使用 XDEBUG_TRIGGER env 时 Xdebug 未启动
我正在使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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 aprogram
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 typingphp
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 settingprogram
...