XDebug not stopping on breakpoints.

Answered

I'm trying to get PHPStorm to stop on the breakpoints I've set in my PHP code. The breakpoints are not stopped on. I'm hoping to get some guidance in trying to determine what I've done wrong. I'm assuming I've misconfigured something. But i don't know what. I'm using PHPSotrm 2017.2 EAP (which may be an issue).

phpinfo() says that:

XDebug:

Version           2.4.0RC2
IDE Key           PHPSTORM

Interestingly php -i says

xdebug support => enabled
Version => 2.4.0RC2
IDE Key => Ben

I think this means that the CLI version is configured differently. Maybe this is due to my Appache stack being run on MAMP Pro? 

Chrome has JetBrains IDE Support 2.0.9 and Xdebug helper 1.6.1 extensions installed and active.

Xdebug helper has the IDE Key: PHPSTORM.

 

The project location as shown in the prject view is C:\MAMP\htdocs\cms

The Host in Settings -> Languages & Framworks -> PHP -> Servers is C:\MAMP\htdocs\cms

What other information might be helpful in trying to determine the issue?

 

 

10 comments
Comment actions Permalink

Hello,

Apache indeed uses different php.ini.

The best way to troubleshoot this would be to:

* validate your server via Run > Web Server Debug Validation
* follow https://www.jetbrains.com/phpstorm/documentation/debugging/ step by step to ensure you configured everything correctly

1
Comment actions Permalink


Hi Vladimir,

I've tried following the documentation as suggested. When validating my server via Run > Web Server Debug Validation, I get the above results. Both Jetbrains IDE Support and Xdebug Helper are enabled in Chrome, meaning they are not ghosted out and both respond to mouse clicks. The page I'm attempting to debug also shows up in the browser. But the break point still is missed. If I programmatically set a break point that is also missed. I don't know what to tell you at this point. The documentation is suggesting that I should see different behavior than what I'm seeing. How else can I get the debugger to work?

 

0
Comment actions Permalink

Are you receiving "Debug session stopped without being paused" popup in IDE? Or an error message about path mappings configuration missing in Debug console window?

How do you start a Debug session? Via web browser? Do you have "listed for incoming xdebug connection" button enabled (green phone button)?

Also you might want to try to install xdebug 2.4.1 stable instead of RC version.

1
Comment actions Permalink

Hi Dmitry,

Sorry for the delay in responding. No, I'm not receiving the "Debug session stopped without being paused" popup. I don't see an error message in either the Console in the IDE or an error message in the console in the browser.

I usually start the debug session by clicking the telephone icon in the IDE. The clicking the debug icon in the IDE. After clicking the debug icon in the IDE the browser loads, but no page is shown. The URL it gets stuck on is: 

chrome-extension://hmhgeddbohgjknpmjagkdomcpobmllji/loading.html?url=http%3A%2F%2Flocalhost%2Fcms%2Fadmin%2Fcategories.php

The green bug is enabled in the web browser and it's enabled in the IDE.

I'm not sure how to install xdebug 2.41 stable. The version of xdebug is supplied automatically as part of MAMP Pro. I'll see if I can find out a way to reference a non-rc version.

0
Comment actions Permalink

I changed the version of xdebug to a stable version and noticed that the page loads and displays when starting the debug session from the IDE. Both the debug icon in the browser and IDE are green and enabled. The breakpoints are still not being hit.

0
Comment actions Permalink

Collect xdebug logs then -- at very least it will tell where it tries to connect (if at all) and what's the response: https://xdebug.org/docs/all_settings#remote_log

Try also placing xdebug_break(); in your code (programmatic breakpoint; will also trigger debug session)

From your screenshots alone it all looks OK... but please provide php_info() output captured via browser (top header with xdebug info + whole xdebug-specific section)

0
Comment actions Permalink

> I usually start the debug session by clicking the telephone icon in the IDE. The clicking the debug icon in the IDE. 

Please try to start the session like this:

* Enable PhpStorm to listen for incoming connections (telephone icon should be in accepting state)
* Open the page you debug in PhpStorm, set some breakpoints, do not click Debug icon
* Open that page in browser* Enable debug via Xdebug extension (grey bug icon -> Debug -> green bug icon)
* Refresh the page

0
Comment actions Permalink

I wound up going to a PHP group and asking one to the guys more familiar with xdebug to help me take a look at the issue. What I found out was that I did need the original RC version of the dll and that the behavior of the debugger is different from what I was expecting.

I was expecting that the debugger would only break on errors and breakpoints. What I found was that the debugger stops execution of the application before any break point is set, and, for some reason, the console tab becomes selected automatically after each break in execution. This ends up hiding the debugger output.

Any reason why automatically switching to the console tab after each break in execution is helpful for the debugging workflow?

0
Comment actions Permalink

> What I found was that the debugger stops execution of the application before any break point is set

Check if you have Run > Break at first line in PHP scripts option enabled.

> the console tab becomes selected automatically after each break in execution

Right click the Console tab and uncheck "Focus on Startup" option.

2
Comment actions Permalink

Thanks Vladimir, that changed the behavior back to what I was initially expecting. I think the IDE debug is working now. 

1

Please sign in to leave a comment.