PHPStorm inconsistently shows that XDebug port is busy.

I am trying to configure XDebug and PHPstorm to work together.

1. I am providing this XDebug configuration:

xdebug.mode=debug
xdebug.client_port=9001
xdebug.client_host=host.docker.internal
xdebug.start_with_request=yes
xdebug.log=/var/log/xdebug.log
xdebug.idekey=PHPSTORM

2. I am restarting server and open page with phpinfo();

3. I copy phpinfo(); text into Validate → Output phpinfo() field. 

4. I see error port 9001 is busy

I want to note that netstat -tulpn | grep ‘:9001’shows nothing.

---

Ok, since this port is used by something let's try to change it. PHPStorm suggests random port 41069, so I will try to use it:

1. I change configuration to following:

xdebug.mode=debug
xdebug.client_port=41069
xdebug.client_host=host.docker.internal
xdebug.start_with_request=yes
xdebug.log=/var/log/xdebug.log
xdebug.idekey=PHPSTORM

2. Add 41069 into field Php → Debug → XDebug → Debug port

3. I am restarting server and open page with phpinfo();

4. I copy phpinfo(); text into Validate → Output phpinfo() field. 

5. I see error port 41069 is busy. Again!

 

While it was possible that something was using port 9001, I am pretty sure that I never used port 41069 previously for anything in my life.

I tried same steps several times with random ports suggested by PHPStorm and every time PHPStorm said that port is busy.

I tried to restart PHPStorm several times, but it didn't help. I tried to restart my PC several times and found out that sometimes PHPStorm+Xdebug works normally and sometimes I encounter this bug with busy ports. I am not sure what it depends on.

2

I can't help you with a fix, but just wanted to tall you that I have had exactly the same issue.

It had been working fine, but I was trying to get JavaScript debugging set up (a whole different set of problems!) and was re-configuring the set up and I kept getting this error.

I tried moving ports and killing all sorts of processes, but the issue still continued. In the end I just ignored it and it worked. (JS debugging issue was a separate, browser related problem).

0

Hello,

Could you check if by any chance the port isn't taken by the IDE built-in web browser?

File | Settings | Tools | Web Browsers and Preview

 

0

请先登录再写评论。