PHP VSCode Xdebug 错误::监听 EADDRINUSE: 地址已在使用中:::9111

问题描述 投票:0回答:2

我确定在运行调试之前该端口没有被使用(按

F5
)我已经杀死了使用9111的进程,但它也无法运行并提示我同样的错误。我也尝试过更改端口,得到同样的错误。

lanch.JSON

{
// 使用 IntelliSense 了解相关属性。 
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    
    
    {
        "name": "Listen for Xdebug",
        "type": "php",
        "request": "launch",
        //"hostname": "192.168.0.104",

        //"localSourceRoot": "${workspaceRoot}",
        "port": 9111
    },
    {
        "name": "Launch currently open script",
        "type": "php",
        "request": "launch",
        //"program": "${file}",
        //"cwd": "${fileDirname}",
        "port": 9111
    }
]

}

PHP.ini

xdebug.remote_host = 127.0.0.1
xdebug.remote_port=9111
xdebug.client_port = 9111
xdebug.remote_enable=true
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_autostart = On
xdebug.auto_trace = Off
xdebug.show_exception_trace = Off
xdebug.var_display_max_children=128
xdebug.var_display_max_data=512
xdebug.var_display_max_depth=15

F5
后,我的VSCode显示了这一点。浏览器打不开,

然后我点击 xdebug 的脚列表:

当我点击listen Xdebug时,它显示一个错误:

php visual-studio-code xdebug
2个回答
1
投票
  1. 终止当前持有端口 9111 的任何进程。为此,请以管理员身份打开终端(或 CMD)

    a) netstat -ano |查找字符串:9111(Windows) netstat -tunlp | netstat -tunlp | grep 8080

    b) 使用上一步中找到的进程 ID 停止进程。 停止进程(Windows) 须藤杀死-9

  2. 然后再次单击开始调试(在 VSCode 中)。


0
投票

有时,当您在远程服务器上使用 xdebug 和 vs code 时,会发生这种情况,并且 vscode 由于某种原因突然被终止。所以远程服务器没有从服务器收到终止消息来不监听 xdebug 9003 端口。

我也发生了同样的事情,并尝试了以下对我有用的命令。

kill -9 $(lsof -n -i:9003 -P)
© www.soinside.com 2019 - 2024. All rights reserved.