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.

15 comments

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

4

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

 

1

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

1

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

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

@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

Please sign in to leave a comment.