XDebug on port 9000 with a virtual machine - EADDRINUSE :::9000

port 9000 is frequently used by default configurations of other apps (for example native apache on MacOsX), also VMs, Docker containers, etc...

A reliable solution would be - to use a different port. For example, 9001 :)

That means:

  • updating your IDE xdebug configs from port 9000 to 9001;
  • adding to your php.ini (xdebug.ini) the line

    xdebug.remote_port=9001
    

Also, you can check your 9000 port usage by some tool like telnet


I found the answer myself just about.

The problem was laying on the configuration of Virtualbox.

On the Network settings, there was a port forwarding for the port 9000, which blocked my debugger from running locally. Once removed, it worked without problem.


You are trying to do a launch operation in your launch.json, which will result as vscode trying to start a new instance of php with an xdebug on port 9000.

Try replacing your launch config by an attach config.

Hope it helps.