如何在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
相关产品推荐
相关产品推荐

