Enr*_*ent 13 php virtualbox xdebug visual-studio-code
我在VirtualBox VM上运行我的Symfony应用程序.PHP正在使用XDebug运行,并且已正确配置.我知道这一点,因为其他人已设法使其与同一个VM的快照一起工作.
当我尝试在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
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是当我点击"开始调试:侦听XDebug"时,我收到以下错误:
错误:听EADDRINUSE ::: 9000
我试图杀死正在使用该端口的进程......令我惊讶的是,这是我尝试连接的虚拟机.
我在这个配置中错过了什么?
小智 5
您正在尝试做一个launch在你的操作launch.json,这将导致作为vscode试图启动PHP的新实例在端口9000的Xdebug的。
尝试用launch配置替换您的attach配置。
希望能帮助到你。
小智 5
端口 9000 经常被其他应用程序(例如 MacOsX 上的本机 apache)的默认配置使用,还有虚拟机、Docker 容器等......
一个可靠的解决方案是 - 使用不同的端口。例如,9001 :)
这意味着:
添加到您的 php.ini (xdebug.ini) 行
xdebug.remote_port=9001
Run Code Online (Sandbox Code Playgroud)此外,您可以通过某些工具(如 telnet)检查您的 9000 端口使用情况
| 归档时间: |
|
| 查看次数: |
2065 次 |
| 最近记录: |