You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VSCode中指定使用xdebug.php-debug进行PHP调试?

解决VS Code中指定PHP调试扩展的问题
  • 打开VS Code的调试面板,点击「创建launch.json文件」(已有配置则直接编辑)
  • 在launch.json的配置项里,确保type字段设为"php"——这是xdebug.php-debug扩展对应的调试器类型。示例配置如下:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 0,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ]
        }
    ]
}
  • 保存配置后启动调试会话,VS Code会优先使用type指定的调试器(即xdebug.php-debug),不会被devsense.phptools-vscode拦截。
  • 如果devsense仍有干扰,可在VS Code设置中搜索phptools.debugger.enabled,将该选项设为false,这样既能禁用devsense的调试功能,又能保留它的代码提示、语法检查等其他功能。

内容的提问来源于stack exchange,提问作者Loki

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 17:54:53