Can't figure out setup debugger

Hi all

newbie here :-)

I recently started the trial version for PHPStorm to try something else than VSCode. Now I am trying to setup my debugger a few days but still without luck... I don't know what I have to setup more? In my VS Code this in the launch.json is enough but appreanlty in Webstorm not.

"configurations": [
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9090
Because I always receive (reason: Address already in use) Or when I chance my port because I think that's the issue I receive exact the same message for for example 9000. 
When I run my command lsof -I 9090 or 9000 I only see PHPStorm services running. After killing them and restarting my PHPStorm the issue isn't resolved.
Is there something else I can try? Or something I am being terrible wrong?
Thanks in advance




Hi there,

Where do you use that port number in PhpStorm? Show screenshots of the Settings/Preferences screens where you have set it. Sounds like you have set it in the wrong place.


Have you verified that the port you are listening on for xdebug in PHPStorm (Preferences -> PHP -> Debug Xdebug -> Debug port) is the same as you have configured in your xdebug settings on your computer/server?


Yes I have. I also checked my php_info() but there nothing seems wrong? See screenshot . Validated my php_info()


Baccarne Robbe

1) Yes, that's the right place.

Please also show what do you have at "Settings (Preferences on macOS) | Build, Execution, Deployment | Debugger" (just in case)

2) What about "phone handle" icon -- is it green / enabled? Make sure it is disabled and check with "lsof" if the port is still in use.

The icon I'm referring to is what you have on your screenshot on point #3 where it says "Stop Listening" (so it's enabled right now).

3) Because I always receive (reason: Address already in use)

Where? Can you show a screenshot of that please.


I'm just trying to figure out what you may be doing wrong: you may have set the Xdebug port number in the wrong place .. or it's all done correctly so it's something else. Possibly you are not showing the whole picture (omitting certain nuances).


BTW / just in case:

1) The IDE will NOT stop listening on the prev Xdebug port while it listens for incoming debug connections (the phone handle is green/enabled). You need to stop it and start again so it will use the new port.

2) The place on a screenshot is the only place where you change Xdebug port. No other places.


Andriy Bazanov

Ok so recap :-) Tried some stuff today. AKA fully started from scratch
First of all all my settings for now how I have them set:

PHP > Debug

The Debugger validation seems ok

My php.ini I have setup like this now:

Under PHP > Servers I have now a server setup like this

For testing everything I created a test.php file :-) 

The "Run" & "Debug" buttons working as expected. "Run" will give no errors & start my tests. "Debug" Will jump to the breakpoint (L3) and I can start debugging in the file.
But the "Start listening ... ". Currently does litter lay nothing. Not even a warning or an error :/

Is there something I have overseen this time? Don't think it's with PHPStorm, just think I have a Xdebug port setup wrong somewhere? 



@Baccarne Robbe

What are you trying to debug: a CLI script or a web page?

Xdebug must see the "debug me" flag (a GET/POST param or a COOKIE/ENV variable) or be configured to try to debug every single request in order to attempt the connection to the debug client.

When you click on "Debug" button the IDE passes needed params to the CLI interpreter (for CLI script debug) or GET param for a web page. But when you use "Listen for debug connections" (the phone handle) such flag is your responsibility. For browser it would normally be Xdebug extension that once clicked sets the Xdebug cookie for the next request.


Finally figured it out. Only the "Start listening for debug con... " is not working. But I can work with the "Debug" button.

Figured out that I forgot to setup PHP remote debug:


Andriy Bazanov thank you, your last answer helped me understand an issue I was having and finally see the difference between the configuration needed for Run/Debug (and the workflow) and Zero-configuration sessions.

But a bit still remains: when using a working Run/Debug config, I can see the following command generated by PhpStorm:

[docker-compose://[\\wsl.localhost\Ubuntu\home\aruku\projects\project1\docker-compose.yml]:php/]:php -dxdebug.mode=debug -dxdebug.client_port=9000 -dxdebug.client_host=host.docker.internal /var/www/html/prueba.php

There is no XDEBUG_TRIGGER variable on the container: is the IDE just listening for all incoming connections and it just accepts the one that matches the path of the file?



There is no XDEBUG_TRIGGER variable on the container:

The trigger / "debug me" flag should be passed via ENV variable (XDEBUG_CONFIG and/or XDEBUG_SESSION I believe). Try to debug a file with `phpinfo()` and it should be there in $_SERVER vars section.

is the IDE just listening for all incoming connections

PhpStorm does not care about IDE_KEY content (if that's what you mean). It will accept any key except where it is required (i.e. "PHP Remote Debug" type of Run/Debug Configuration, for comms with DBGp Proxy when it is used)

and it just accepts the one that matches the path of the file?

  • For web requests it checks the Server (host) name and port first and then the path mapping.
  • For CLI it checks the special ENV var (PHP_IDE_CONFIG=serverName=SomeName) so it knows what "PHP | Servers" entry to use and then checks the path mappings there. NOTE that the someName here is the actual name of the Server entry in the IDE settings and not the host name as in web request case.
  • In both cases "PHP | Servers" is used so the IDE knows how to map the remote path to a local one. NOTE that you can tell PhpStorm to completely ignore sessions where no matching Server entry is found (so it will not even notify about that connection attempt).

If you initiate the CLI debug session from within the IDE (the Debug button) it will set that ENV var up for you (it is just not shown in console like the actual run command is; you would need to enable the extra debug logging on the IDE side and see the logs for that). But if you initiate the debug outside (and only listen / "phone handle" in the IDE then you need to set that var yourself). Check the Help pages, should be in "Starting a debugging session from the command line" article, under "Configure path mappings" section.