XDebug not working anymore

Answered

Hello,

The debugging is not working anymore on any of my project, when I start listening to incoming connection the script is blocked until I stop to listen to connections, even if I have no breakpoints on my code. And when I put a breakpoint on the first line (it's not working on others lines), the script is indeed stopped, but when I tell him to go to next line it block again (even with the simplest code possible).

I tried to check the debug configuration everything is ok (I used the validator from phpstorm), the path mapping is also ok, well last week everything worked fine and I changed nothing so ...

Here is my configuration on my php.ini :

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log=[path]/xdebug.log
xdebug.idekey=PHPSTORM

And here are some part of my xdebug.log when i put a breakpoint on first line then do a step over :

[4605] Log opened at 2019-03-12 14:13:50
[4605] I: Connecting to configured address/port: 127.0.0.1:9000.
[4605] I: Connected to client. :-)
[...]
[4605] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="19" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" [...] </property></response>
[...]
[4605] <- step_over -i 21
[4605] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="21" status="break" reason="ok"><xdebug:message filename="file:///[path]" lineno="4"></xdebug:message></response>
[4605]

The first response is when it stopped on the breakpoint on the first line, I have everything working fine with variables as "$_COOKIE" logged, then I do the step over, and the script is like stuck. And the problem can't be in the code, I tried with a script with only 2 "echo". I tried to restart apache, I tried to restart phpstorm, and I tried to restart my computer, nothing changed.

 

My phpstorm version :

PhpStorm 2018.1
Build #PS-181.4203.565, built on March 28, 2018
You have a perpetual fallback license for this version
Subscription is active until November 24, 2019
JRE: 1.8.0_152-release-1136-b20 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-102-generic

My php version :

PHP 7.1.27-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:02:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.27-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.0, Copyright (c) 2002-2019, by Derick Rethans

Do you have any idea of what is hapening ? (it seems my php version was built last week, maybe it's linked ...)

12 comments
Comment actions Permalink

If someone else have the same problem, xdebug 2.7.0 is not working with phpstorm 2018.1, you need either upgrade phpstorm or downgrade xdebug. I upgraded phpstorm to the version 2018.3 and now everything is fine.

3
Comment actions Permalink

Thanks for sharing!

0
Comment actions Permalink

Thanks Yrtiop!

0
Comment actions Permalink

I thought I was the only one!

Problem is, I'm using PHP 7.3 for which you need xdebug 2.7. So updating (ie purchasing) to a new version of PhpStorm is the solution if you want to use php 7.3.

0
Comment actions Permalink

You are amazing! Indeed, xDebug  versions > 2.6 don't properly work in the PhpStorm 2018.1 or 2018.2 versions. Had the same problem when upgrading Laravel Homestead - maybe some guide for people that ran in the same problem:

Switch your box default php version to 7.1 (optional):
sudo update-alternatives --set php /usr/bin/php7.1

Run the following command to enable xDebug (enable xDebug in all PHP versions):
xon

You have to set this configuration manually for the project PHP version you are using - in this case, PHP 7.1 (/etc/php/7.1/fpm/conf.d/20-xdebug.ini):
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.max_nesting_level = 512
xdebug.remote_log=/home/vagrant/code/xdebug.log

Restart you NGINX (for the kicks) and php-fpm:
sudo service php7.1-fpm restart
sudo service nginx restart

0
Comment actions Permalink

This seems to be occurring again with xdebug >=  3.0 and phpstorm 2020.3 (maybe others)

Realizing that xdebug >= 3.0 has specific upgrade requirements that I haven't made adjustments for yet.

https://xdebug.org/docs/upgrade_guide

0
Comment actions Permalink

@Eric Morris

Please state your exact PhpStorm, PHP and Xdebug versions.

0
Comment actions Permalink

Yes for me as well the weird thing is it does not always always. The first eg 2-3 run works fine then stopes working:
phpStorm: 
PhpStorm 2020.3.1
Build #PS-203.6682.180, built on December 30, 2020
Runtime version: 11.0.9.1+11-b1145.63 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 3029M
Cores: 8
Non-Bundled Plugins: com.godwin.json.parser, com.intellij.ideolog, com.intellij.properties, de.netnexus.camelcaseplugin, net.seesharpsoft.intellij.plugins.csv, com.dmarcotte.handlebars, com.aurimasniekis.phppsr4namespacedetector, com.kalessil.phpStorm.phpInspectionsEA, de.espend.idea.php.annotation, fr.adrienbrault.idea.symfony2plugin, ru.adelf.idea.dotenv

PHP and xdebug:
PHP 7.4.13 (cli) (built: Dec 11 2020 12:22:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v2.8.1, Copyright (c) 2002-2019, by Derick Rethans
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies

and i am using docker but i don not think so this is the problem i just tried on my local but nothing...
Although when it stopes working i restart the docker container and again working for couple of times. 

The php, xdebug and OS did not changed only the storm 

0
Comment actions Permalink

@Csaba Nagy

with Xdebug v2.8.1, Copyright (c) 2002-2019, by Derick Rethans

Please upgrade Xdebug to the latest 2.9.8 (2.9.6 at least) and see how it works there -- https://bugs.xdebug.org/1766

https://stackoverflow.com/a/65292337/783119

1
Comment actions Permalink

Andriy Bazanov

I upgraded but still nothing i checked all the settings but nothing changed couple of times it is working then i have to restart the container and on local it does nothing.
At the moment i do not want to upgrade the php to 8 because first we have to wait couple of vendor to upgrade their code first so i have no choice just to stick with this version.(i have tried xdebug 3 but it did not work)

0
Comment actions Permalink

@Csaba Nagy

Xdebug 3 works just fine (on my Windows 10 with latest builds of 7.2, 7.3, 7.4 and 8.0). Just make sure to go through Xdebug: Upgrading from Xdebug 2 to 3  and update your Xdebug config.

There is no need to rush to upgrading to PHP 8 indeed for now, especially for existing projects that have lots of dependencies (especially if it's binary one: PHP extension).

That https://bugs.xdebug.org/1766 is the only ticket I could think of (that describes such behaviour).

 

I suggest you to try all that using the same docker image but a different code base (e.g. some simple few pages site that does not use the same framework/libraries ... or a basic project but for another/ideally completely different framework) -- maybe it's specific to your setup.

Other than that: enable Xdebug log (xdebug.remote_log for v2, xdebug.log for v3) + on PhpStorm end (https://www.jetbrains.com/help/phpstorm/troubleshooting-php-debugging.html#collecting-logs) and see if it will produce anything interesting. Maybe PHP/Xdebug just crashes?

1
Comment actions Permalink

Andriy Bazanov

Thank you! i just check the log and it seems nothing happening then i reset everything PHP, xdebug, Storm and now it is working just fine. possible i will upgrade to xdebug v3. I guess the upgrade set something i did not recognised (i could not find it but after reset it fixed).

1

Please sign in to leave a comment.