Can't start listening for connections from 'xdebug': Port 18000 is busy


I have a site running on vagrant ( . Here's the xdebug settings in php.ini:

xdebug.default_enable = 1
xdebug.idekey = "vagrant"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 18000
xdebug.remote_host= ; IDE-Environments IP, from vagrant box.

Here are my settings in PHPstorm8:

As soon as I click on 'start listening for PHP debug connection'  I get an error saying port 18000 is busy.

Port 18000 is free until I either start PHPStorm or start debugging session in chrome.

This is the first time I am using PHPStorm and my assumsion is that my php.ini settings and PHPStorm settings are incorrect.  Please assist.

Comment actions Permalink

Hi there,

Use netstat and check who is using that port. If anything -- change to another one.

Comment actions Permalink

@Andriy Bazanov as I tried to explain in my original post the port is free until I start phpStorm.  I used sudo lsof -n -i4TCP:18000 to verify.  To clarify: phpstorm starts listening on port 18000 as soon as it starts.   Meaning it starts listening even before I click "start listening for php debug connection" button. Same thing was happing when I was using port 9000.   Is there something wrong in my settings?

Comment actions Permalink

There is nothing wrong with your settings (as per your screenshots).

I do not see how PhpStorm can start listeing on xdebug port (be it 9000 or 18000) automatically on start:

  • never did it to me on my Windows 7 machines (2 PCs) .. and so far I have not hear anything like that here on forum on Issue Tracker.
  • it has no code to automatically "listen for incoming debug connections" (which some people do request actually).

Right now I may only suggest:

  • disable all 3rd party (non bundled by default) plugins and see if it will make any difference
  • check your idea.log for any possible additional hints (what else may be using that port)
  • double check your IDE settings for that port (maybe do global search for "18000" in all config files) -- . Possibly you have changed some another value elsewhere (my only thought in thig regard right now would be built-in simple web server)
  • backup and delete all IDE configs and start from scratc (as last resort, of course) -- see URL above
Comment actions Permalink

Deleting all the config files and then putting in all setttings did the trick.  PhpStorm no longer starts listeing on any port soon as it starts.  Remote debuggin is now working :)

Comment actions Permalink

Just a note for others that have this issue - I was following the steps outlined here for profiling plugin cpu usage, and I started to experience this issue.  Went away after I removed the line `-agentlib:yjpagent=delay=10000,probe_disable=*` from phpstorm.vmoptions.  One more option to try if folks are still stuck.


Please sign in to leave a comment.