Valet-plus: XDebug error: listen EADDRINUSE :::9000

Created on 22 May 2019  路  9Comments  路  Source: weprovide/valet-plus

I've installed the PHP Debug extension in VS Code, generated the launch.json file with a 'Listen for XDebug' config, installed the Firefox XDebug helper, and enabled XDebug in Valet using valet xdebug on.

But when I click the green debug arrow in VS Code, I get this error: listen EADDRINUSE :::9000.

Have I done everything correctly, and if so, any ideas what could be causing this error?

Most helpful comment

@vanthao03596 you can change the port Xdebug is listening to in /usr/local/etc/valet-php/{php-version}/conf.d/z-performance.ini and change xdebug.remote_port=9000.
Don't forget to change the port in PhpStorm as well.

All 9 comments

Here's my launch.json file:

{
    // 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
        }
    ]
}

You can check what's listening on port 9000 with lsof -n -i -P | grep LISTEN to see what's blocking phpstorm to listen on that port.

I've got around this by using port 9001 instead.

I've got around this by using port 9001 instead.

Hi, i got same error, please guide me to change port.

@vanthao03596 you can change the port Xdebug is listening to in /usr/local/etc/valet-php/{php-version}/conf.d/z-performance.ini and change xdebug.remote_port=9000.
Don't forget to change the port in PhpStorm as well.

@SanderAtom In /usr/local/etc/valet-php/7.2/conf.d there is no z-performance.ini. Only an ext-opcache.ini.

My phpinfo() is saying the path is /usr/local/etc/php/7.2/conf.d/z-performance.ini. If i change the port in this config file, restart valet phpinfo()still says port 9000.

I am searching and trying now for hours, i don't know why php is not changing the port ...

Can you join our Slack through https://github.com/weprovide/valet-plus/#get-in-touch ?
Easier to debug what's going on. You should be using [email protected] for php, not the regular php. This means it might be misconfigured or your Valet+ is not up-to-date.

@SanderAtom thanks you so much.

came across this issue on VScode for windows , the best way (if you dont want to change the port number) , open up powershell
run this command

Get-Process -Id (Get-NetTCPConnection -LocalPort 9000).OwningProcess

then kill the process with with the process id in the table

| Handles | NPM(K) | PM(K) | WS(K) | CPU(s) | Id | SI | ProcessName |
| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- |
| 261 | 148 | 20788 | 26296 | 6.25 | 18748 | 4 | Code|

for me it was Id 18748 , some instance of vs code still running.
so kill the process with the proper process id

Stop-process -Id 18748

or you can look that up in task manager and kill it

hope that helps to any one looking for this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dustbuster picture dustbuster  路  5Comments

dannygsmith picture dannygsmith  路  3Comments

dingo-d picture dingo-d  路  4Comments

aronwp picture aronwp  路  4Comments

perteraul picture perteraul  路  3Comments