我正在 VirtualBox VM 上运行 Symfony 应用程序。 PHP 正在使用 XDebug 运行,并且配置正确。我知道这一点是因为其他人已经设法让它与同一虚拟机的快照一起工作。
当我尝试在 VS Code XDebug 中配置时,我使用以下 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": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
但是当我单击“开始调试:监听 XDebug”时,出现以下错误:
ERROR: listen EADDRINUSE :::9000
我尝试终止正在使用该端口的进程...令我惊讶的是,这就是我尝试连接的虚拟机。
此配置中我错过了什么?
最佳答案
您正在尝试在 launch.json
中执行 launch
操作,这将导致 vscode 尝试启动一个新的实例php 在端口 9000 上使用 xdebug。
尝试将 launch
配置替换为 attach
配置。
希望有帮助。
关于php - 使用虚拟机在端口 9000 上进行 XDebug - EADDRINUSE:::9000,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50644667/