xdebug works only with first line

Hi. I use remote xdebug configuration to debug my code. I use virtual machine with ubuntu, and my host machine has windows 10 with PhpStorm. I used to debug my projects with the same configuration without any problems, but recently, on a new pc, I faced this issue when xdebug breaks only at first line, and keys like F8, F7 (Step Over) don't work. Browser tries to load a page, but it never ends. I even disabled my firewall on Windows 10, but it seems it's not about blocking a connection by a firewall.

I reviewed similar posts here, but I didn't find anything that could help. Here is my xdebug config:

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9111
xdebug.idekey=PHPSTORM
xdebug.remote_log=/vagrant/testapp/xdebug.log

In my browser, I use bookmarklets (start, stop debug). In order to do a remote debug, I use ssh tunnel to my vagrant machine:

ssh -R 9111:127.0.0.1:9111 vagrant@192.168.33.10 (I run this line inside MINGW64/"Git Bash" terminal on Windows 10)

My cli php -v output here:

So, the problem you will see on my screenshots. When I set a breakpoint on a 5th line, it's not going to break, and the browser tries to load the page without success. (xdebug log is here, https://pastebin.com/aMZXTMkF )

As you can see here, path mapping is fine.

When I set a breakpoint on the first line, it actually breaks, but I cannot debug furthermore. Pressing F8, it seems, just ending the whole script, but red square "Stop" button is active.

Next screen shows what happened after I press F8:

I hope I described my issue clearly. Any ideas what I did wrong? or why xdebug is not working?

Thanks.

1
25 comments

Got a similar issue - with the difference of using docker instead of  a VM.

It does break on first line and event log in phpstorm complains about 
" Debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for 'localhost (1)' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
Do not show again"

When debugging is enabled in browser. So i know it's listening and working.

The project is open from the same folder that docker uses  - so they are 1:1 identical and even with path mapping set to " /var/www" or the win dir - nether works.


0

The host in 

xdebug.remote_host=127.0.0.1

should be pointing to a machine where IDE is running as seen by vagrant vm. Please correct this & it should work afterward.
 

The project is open from the same folder that docker uses - so they are 1:1 identical and even with path mapping set to " /var/www" or the win dir - nether works.

A screenshot that illustrates path mappings + xdebug.log would help.
0

Thank you for the reply Dmitriy.

I know that xdebug.remote_host should be pointing to a machine where PhpStorm is running. In my case, my host machine with IDE has ip - 192.168.33.1 . And of course, I tried that IP in "xdebug.remote_host" param. It didn't solve the problem. Originally, I used "xdebug.remote_host=127.0.0.1" because I was using ssh tunnel to my VM as I mentioned in the first post. But either way, issue still exists.

0

Do you have Run > Break at first line in PHP Scripts enabled? If you do - please disable.

Do you have "Listen for incoming connections" green phone-like button toggled? Could you please check with netstat that it's phpstorm64.exe is listening on 9111? Btw, did you set the 9111 port at File | Settings | Languages & Frameworks | PHP | Debug?

0

1. Run > Break at first line.. is currently disabled. I tried to enable that before just for testing, and it does work, script breaks at first line as it should, but if I press F8 it just doesn't go to the next line. The last screenshot I provided illustrated what is happening if I try to "Step Over".

2. Yes, "Listen for incoming connections" is green, and netstat shows that phpstorm is listening proper port. Here is screenshot:

3. Yes I set 9111 port in debug options in PhpStorm:

0

Did you set up a correct PHP interpreter (the one Vagrant uses) at File | Settings | Languages & Frameworks | PHP?

Would it work if you just right click a file in a project view > Debug ... (PHP Script) :

 

0

Dmitriy,

Here is a screenshot:

You mean did I set up correct CLI interpreter? Well, I didn't set there anything because I don't feel like I have to do that in order to debug a simple php script like index.php. I remember I was debugging my projects without extra configurations and it was working good.

If I right click index.php, and click "Debug", then "Edit configuration" windows is going to popup:

But the thing is I don't need any configurations for my projects. If I remember correctly, I didn't use such features in PhpStorm when I was debugging. Please let me know if creating or editing new configuration (in PhpStorm) is a necessary thing in order to debug php scripts.

 

Thanks

0

Yeah, it should work without a PHP interpreter. I just wanted to have a quick test in case you got this configured.

Please try to delete mysite.test entry from File | Settings | Languages & Frameworks | PHP | Servers.

Run debugging again. Would it pop up similar window?

 

0

yes, it does pop up similar window. I click accept and then nothing happened. I mean I see my code without any breaks that should be highlighted blue.

In the browser, I see the tab icon is spinning some time until it gets 504 gateway time-out.

0

Please open Help > Debug Log Settings... and add #com.jetbrains.php line. Reproduce this and upload somewhere the idea.log file (Help > Show log in ...).

0

Dmitriy,

Here is my idea.log http://rgho.st/76JjYLhNN

0

Finally, I found the solution. I noticed this "ERROR" line in the idea.log:

... 2018-11-07 21:17:02,909 [  26222]  ERROR - plication.impl.ApplicationImpl - Argument for @NotNull parameter 'remoteFileUrl' of com/jetbrains/php/debug/xdebug/debugger/XdebugDriver.onBreak must not be null ...

Then I google it out. The guy on stackoverflow said that he fixed this error by installing an older version of xdebug. So, I just installed an older version of xdebug - 2.6.1. Now it's working. Problem solved.

Thanks

12

Thanks very very much. I have got the same problem and have solvde with your solution.

 

1

@Kuzaluvo that was frustrating. Can't even find any clue about this and I only found this thread on StackOverflow. Thanks a lot! Can confirm xdebug-2.7.0 does not work. Breakpoint just hangs.

0

I had the same problem and updating PhpStorm to newer version was the solution.

4

Thanks for solving the problem, I suffered half a day with this error.

0

Hi,

I face the same issue with PhpStorm 2017.3.7 and a xdebug 2.7.1 on alpine docker, downgrading to 2.6.1 fix the problem :


FROM wodby/drupal-php:${PHP_TAG}

# Downgrad xdebug to get it working with Phpstorm 2017
RUN sudo apk --update --no-cache add autoconf g++ make && \
sudo pecl install -f xdebug-2.6.1 && \
sudo apk del --purge autoconf g++ make

It was really tricky to troubleshoot this issue since the usual communication problems were not the root : correct port, first connexion ok,  xdebug.log shows requests and responses then timeout.

Kuzaluvo & Dmitry: thank you both !

 

[Edit] This could be mixed sources problem, a colleague of mine doesn't have the problem, but he use a more recent PHPStorm version and he's using Linux.

 

 

 

1

Awesome!

Exactly, that's a problem of Xdebug 2.7.2

It works for me, after I down xdebug version from 2.7 to 2.6

Many thanks to you, @Kuzaluvo

0

Yeah, as Slawooo wrote, the new version out of 2018 to 2019, fixed the problem for xdebug

"

 
 

I had the same problem and updating PhpStorm to newer version was the solution."

2

I have been having this issue with Xdebug version on 2.7.0, 2.7.1 and 2.7.2 and it took a toll on my time. I can confirm that upgrading my Storm to latest version fixed debugging issue with Xdebug. 

2
Avatar
Stepan Peredriy

Thanks! Check both both methods
Upgrading PHPStorm(2018) to last version or downgrading xdebug-2.7.2 to xdebug-2.6.1 works!

0

For the records, I got again the same problem when using conditional breakpoint, at first everything works fine, then I got the same timeout error,  then the PHP itself seems broken it throws errors about undefined variables.

After reinstalling everything (docker, various xdebug version, ...) I found that removing my breakpoints fixed the problem...

0

I was having this problem as well with PHPStorm 2018 but updating to 2019 resolved the issue for me with PHP 7.2 & Xdebug 2.9.3.

0

I wonder why new versions of Xdebug break PhpStorm without a proper warning. How many hours I wasted debugging debugging, it's painful to think about.

0

xdebug - 2.6.1

That is amazing ,problem solved  ,thank you very much

0

Please sign in to leave a comment.