Can't start listening for connections from 'xdebug': Port 18000 is busy
Hi,
I have a site running on vagrant (dev.mysite.com:8080) . Here's the xdebug settings in php.ini:
zend_extension="/usr/lib/php5/20090626/xdebug.so"
xdebug.default_enable = 1
xdebug.idekey = "vagrant"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 18000
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_host=10.16.24.204 ; IDE-Environments IP, from vagrant box.
Here are my settings in PHPstorm8:
http://picpaste.com/pics/AiV9SRTy.1421606432.png
http://picpaste.com/pics/Orqp44WY.1421606620.png
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.
Please sign in to leave a comment.
Hi there,
Use netstat and check who is using that port. If anything -- change to another one.
@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?
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:
Right now I may only suggest:
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 :)
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.
Yes, the IDE is buggy - it makes the problem and a support tells you have a problem, not they.
I used PhpStorm, now using Intellij, the problem still the same - IDE occupies 9003 port and cannot use it :D
But the support for years tell the same - it is impossible, there is something on your side!
I am very angry about.
What cache should I delete? Windows 10.
Deleting of files in that dirs didn't help
@rokkybaliboa
Unlikely. In all cases that I remember where standard Xdebug port was involved it was a user error (a person is used that port in the wrong place) or a system (another app already uses that port -- because user did not know about it (the case with 9000 port, used by default by php-fpm) or misconfiguring their docker etc.)
Now, as per your 2nd screenshot (the one with netstat info), it's your IntelliJ IDEA that listens on that 9003 port (and Docker on 9000 -- why?). These ports is not something that the IDE or Docker will use for own needs, so extremely likely it will be a misconfiguration by the user.
For 9003 -- go to the IDE settings and type "port" in the search box -- now go trough all places (should be only a few of them where the input field is) and post a screenshot of all places where it is used.
That is Laradock default settings - listen to 9000 port inside and show it on 9003 port outside.
Previous time I changed the port to 9006 and it helped. This time I checked before is 9006 port is free, changed outer docker port to 9006, but it doesn't help, now it is busy :D
Finally I removed the IDE, removed install and app local and roaming dirs. The only thing I forgot is IDE's docker container. And installed again... IDE still remembers me e.g., my test run configuration!
I can give a remote access with TeamViewer if needed
Sorry, this does not make sense to me (what for / what it does). Maybe you are explaining it wrong or misunderstood what it does...
Xdebug port is to be used by the IDE and nothing else (except Xdebug itself, ofc).
Good. So you have deleted the IDE-wide settings.
Run/Debug Configurations are Project-level settings and stored in PROJECT_ROOT/.idea folder.
It's possible .. but now now (Monday morning). Maybe later in the day if you still will be unable to solve it.
Oh, yes, now I removed .idea dirs in projects and even registry data.
And set up PhpStorm. The problem persists
So it's a docker (Laradoc) issue then?
Just in case:
Shut down your docker / make sure no containers are running at all and try activating "phone handle" icon then. Does it work?
I noticed there is probably one place on screens is repeated, so checked ports again. Got these 3 processes on 9003 port:
[wslhost.exe]
[com.docker.backend.exe]
[com.docker.backend.exe]
Then I closed Docker Desktop as you wished. There were not any 9003 occupied ports.
Then I activated "phone handle", it works, there are 2 processes phpstorm64.exe on 9003 ports
> So it's a docker (Laradoc) issue then?
I don't know. I hoped there was an IDE's cache with 9006 port because I did have working debug in PhpStorm before, a year ago, after replacing 9003 occurrences with 9006. But yesterday it didn't help
You are right!
I removed these lines from Laradock docker-compose.yml:
ports:
- "${PHP_FPM_XDEBUG_PORT}:9003"
and xdebug in PhpStorm now works, there is no "Port 9003 is busy" message, I see variables' values.
Intellij IDE is not buggy, I am buggy, thanks a lot for your help!
Should work -- the IDE does not "cache" anything here.
A few points to remember: