PhpStorm debugger not stopping at BreakPoints; keeps waiting for xdebug _SESSION_

PhpXdebugPhpstorm

Php Problem Overview


Updated question : PhpStorm | WebMatrix (IISExpress) | Xdebug.remote_port | — Which Port(s) to put where?


I'm running localhost web server on my Windows machine with WebMatrix and IISExpress. I've installed PHP and Xdebug in it and they both are working.

I have a local WordPress install.

I'm now trying to get PhpStorm to debug it using Xdebug.

When I run PhpStorm it launches the web app in the browser with relevant debugging parameters in the browser.

IDE KEY is matching

ide

xdebug.remote_port is configured correctly. (Later I found that this is wrong, but not erroneous. It should be port 9000)

xdebug.remote_port

But it seems Xdebug never gets to communicate with PhpStorm. PhpStorm keeps listening, and the execution runs completely without stopping at any break-points.

PhpStorm PhpStorm

Php Solutions


Solution 1 - Php

These lines are crucial to make it work (in php.ini):

zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_autostart = 1 # <-------- THIS
xdebug.remote_enable = 1 # <----------- AND THIS

Without these lines xdebug will never work on phpstorm ;)

Solution 2 - Php

Try changing the xdebug listen port in your php.ini and your IDE.

Running Mac Yosemite, for me the problem was that I installed with homebrew, following a guide that used php-fpm, which uses port 9000 by default (which conflicts with the xdebug default port)... Changing my xdebug.remote_port to 9001 and changing the xdebug port in phpstorm fixed the problem, though I suspect this issue could happen for anyone in any IDE. I googled for the better part of a day and didn't see this solution (since I believe it's so specific to install method).. but I hope it helps someone.

Solution 3 - Php

Took me about an hour until I noticed that this button wasn't activated ;)

"Run" -> "Start Listening for PHP Debug Connections"

enter image description here

Solution 4 - Php

First check for on what port xdebug is working on, you can find it in your php.ini under xdebug.remote_port=9123. As you can see in my case it is set to 9123.
Now open PhpStorm go to php debug, see screenshot: enter image description here

under Xdebug you will find Debug port, make sure that its value is the same as in the php.ini file under xdebug.remote_port (9123 in my case).

Hope it helps

Solution 5 - Php

For me it was changing the line:

xdebug.remote_host=localhost to xdebug.remote_host=myComputerIP

( Mac user: in terminal run ifconfig to find your ip )

Solution 6 - Php

If anyone else runs into this issue and is using Vagrant, this is what finally fixed it for me:

xdebug.remote_host=10.0.2.2

That needs to be the IP address of your local machine from inside the Vagrant box, and 10.0.2.2 is the default. If you ssh into your Vagrant box, it will show the IP where you logged in from if you want to confirm.

I know this isn't directly relevant to the specific setup the OP had, but this post shows up in a lot of xdebug / PhpStorm Google searches so hopefully this can help someone else.

Solution 7 - Php

Could be a Firewall.

Day 572... Still haven't slept or eaten... But I finally found the culprit: Windows Defender!

Basically, I had a firewall blocking JetBrains IDE Support chrome extension from sending data to PhpStorm through the default 127.0.0.1:63342 address.

--- Edit

Day 864... Same issue happened again, this time on Linux... But I finally found the culprit: Ubuntu Firewall!

Seriously, this happened to me again a few months later, using Linux, and it was the firewall again. Disabling the firewall solved it sudo ufw disable - If you care for the firewall and want to keep it enabled, gotta dive in deep on creating some sort of whitelist for it.

Solution 8 - Php

PHPStorm has a build-in tool in Run > Web Server Debug Validation.

It helped me to solve my problem.

enter image description here

Solution 9 - Php

There was a syntax error in php.ini. There were extra "quotes" and ;colons;.

xdebug.remote_port

Solution 10 - Php

I also obtain this error message.
Also was troubles with the php.ini but more subtle.

Try to find and delete a row like this

extension=php_xdebug-...

Consider to look at my answer here for details "Xdebug - command is not available".

Solution 11 - Php

I was having this same problem while trying to test a Laravel project using XAMPP on Windows in PHPStorm. I have no idea what exactly I was doing wrong, but I did get it working eventually. I followed the step-by-step instructions on the PHPStorm site here.

One thing I think that was not configured right was that there was no interpreter set up in the PHP menu in Settings.

I was also trying a few too many combinations of settings in my php.ini. These were the settings that I have when things were working:

zend_extension = C:\xampp\php\ext\php_xdebug-2.3.2-5.6-vc11.dll //as recommended from the Xdebug site itself 
xdebug.remote_enable=1=
xdebug.profiler_enable=1
xdebug.profiler_output_name = "cachegrind.out.%t-%s"

In my Run/Debug Configurations, I use a PHP Web Application setting, that just starts on the root of the site. (At first, I thought the appended ?XDEBUG_SESSION_START=<xxxxxxx> was a mistake, but it is not). Hopefully that might help if someone else is facing a similar issue.

Solution 12 - Php

Right click "Console" tab and uncheck "Focus on startup" (as seen in below image) should do the trick enter image description here

Solution 13 - Php

I had an issue where one project would work and not another one. I tried many different configurations and I tried looking at the logs of xdebug, etc. This fix seems to have resolved my issue:

Try setting your actual ports of xdebug to 9123 instead 9000.

The new version (9) of PHPStorm changed its default xdebug connetion port to 9123 (the PHPSTORM config, not the actual xdebug config), probably for a good reason, since having the PHPSTORM config to the xdebug default 9000 didn't work but having them set to 9123 did work and resolved the issue.

Solution 14 - Php

I tried any of the suggested tricks and finally I called the script by 127.0.0.1/script.php instead of localhost/script.php and bingo!

Solution 15 - Php

Based on peteclark3 answer:

I think one of solutions if you have multiple php-fpm versions with xdebug, like php5.6-fpm, php7.1-fpm - make sure only one is running. I had both 5.6 and 7.1 running. Then tried to change on 7.1 to 9001 port. But if I change to 9001 port in PhpStorm, then 5.6 starts not working, because it listens on 9000. So each time you change php version, then probably you would need to change setting in phpStorm. So I think it is better to have only one of php-fpm running and all php-fpm versions can use same port.

Solution 16 - Php

This fix is specifically xdebug working but breakpoints not working with docker

Step 1 (check if xdebug actually works):

  1. Go to settings in phpstorm and then debug, check the box 'break at first line...'
  2. Try again, if it breaks at first script xdebug is working

Could be the breakpoints aren't working because it can't find the file.

Step 2 (check your paths mappings are set up correctly):

  1. Go to servers (it's below debug)

  2. Make sure you have a server set up and 'use path mappings' selected

  3. Below that ensure that your php files are mapped to the correct path in the docker container. In my case files were mapped to /var/www/files but actually in the container it was /var/www/app/files.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionlaggingreflexView Question on Stackoverflow
Solution 1 - PhpCapyView Answer on Stackoverflow
Solution 2 - Phppeteclark3View Answer on Stackoverflow
Solution 3 - PhpRotaretiView Answer on Stackoverflow
Solution 4 - Phpvlio20View Answer on Stackoverflow
Solution 5 - Phpunismoke.comView Answer on Stackoverflow
Solution 6 - PhpScott WeaverView Answer on Stackoverflow
Solution 7 - PhpLucas BustamanteView Answer on Stackoverflow
Solution 8 - PhpkatmoonView Answer on Stackoverflow
Solution 9 - PhplaggingreflexView Answer on Stackoverflow
Solution 10 - Phpit3xlView Answer on Stackoverflow
Solution 11 - PhpcchapmanView Answer on Stackoverflow
Solution 12 - PhpOscar OrtizView Answer on Stackoverflow
Solution 13 - Phpc-aView Answer on Stackoverflow
Solution 14 - PhptrentView Answer on Stackoverflow
Solution 15 - PhpDarius.VView Answer on Stackoverflow
Solution 16 - Phpjim smithView Answer on Stackoverflow