Need Debugging help: PhpStorm 5.0.4, OSX, MAMP, Xdebug

Hi Everyone -

  I'm having a heck of a time getting breakpoints to work.

  I watched a video on Jetbrains TV, but it covered version 1 and I'm using Version 5.

  Right at the point in the video where the guy debugged and hit a break point, mine flew by my break point, as if it's not even turned on.

  My Environment is
    OSX 10.8.2
    PHPStorm 5.0.4
    MAMP Pro
    Xdebug

    My PHP.ini looks like this:
   [xdebug]
xdebug.default_enable = 1
xdebug.remote_enable = 1
xdebug.remote_autostart=1
zend_extension="/Applications/MAMP/bin/php/php5.3.14/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"


Here are the screenshots of my settings - is there something I have missed?

http://content.screencast.com/users/basementjack/folders/Snagit/media/14649fda-ce48-49ea-ab84-4e7bd5d5fbb2/2012-12-01_16-28-34.png


http://content.screencast.com/users/basementjack/folders/Snagit/media/9f3d7bf0-711a-43c1-b366-7cf66efc6a13/2012-12-01_16-31-34.png

http://content.screencast.com/users/basementjack/folders/Snagit/media/16aa840f-b11d-432c-bec2-1aa13f135b35/2012-12-01_16-35-30.png
0
3 comments

Hi Jack,

  • Is xdebug actually enabled (check output of phpinfo() )? Maybe you editing wrong php.ini file (or whatever file it may be)?
  • Do you have only 1 php debugger activated (no ZendDebugger etc at the same time)?
  • What xdebug version do you have? Try upgrading to latest stable version (2.2.1 I believe -- but that's mainly you have it crashing or only partially working)
  • Have you restarted Apache after making changes to php.ini ?


Also:

  • Instead of debugging real app straight away .. I would recommend starting with some very basic and simple project -- 1 script only, few lines (something like this with each statement on separate line: <?php $a = 1; $b = 3; $c = $a + $b; echo $c; ). Once ready -- do it on your real project.
  • If PHP in CLI mode uses the same config as when invoked via web interface, then try debugging that simple project in CLI mode ("PHP Script" Run/Debug configuration) -- it's easier to ensure that PHP and xdebug are configured properly in this way (no need to restart Apache, no need to play with cookies etc).


In any case -- here is some good article/manual covering your environment: 5 Step Tutorial: PHPStorm + MAMP PRO 2... -- check it to see what you may be missing.

Other links that can be useful:

0

Thanks Andriy for your quick reply!

It started working, but I'm not entirely sure what I did (I don't actually think I changed anything since making that post, though I did stop and restart PHP Storm once)

If I am understanding it right, there are 3 ways to debug.

I thought I had all the configuration stuff set according to the "Debug configuration" method - I'd hit the debug window in phpstorm and expect it to stop on my break point. but it didn't
If I am reading the docs right, in this conifg, it's not necessary to hit the phone icon button that turns on the zero configuration debugging when you're using the "debugging configuration".

I hit the phone icon and my drop down next to it has the config "EasyIftaWeb" from the screenshots and that seems to work.

So I'm able to get back to work now!

Thanks for your quick Saturday Night response and the links!


- Jack

0

1) You have xdebug.remote_autostart=1 -- this means that xdebug will attemp to connect to debug client (PhpStorm in our case) each time when php script gets executed (you may have noticed around 1 sec delay when your script gets executed and no debug actually done)

2) I suspect that when you invoke debug via Run/Debug configuration (which sends all required xdebug parameters in this case -- start_debug flag and debug-session_id) this may somehow conflict with autostart setting (for example -- maybe in this case PhpStorm may only accept xdebug connection with certain ID which gets generated when you execute Run/Debug configuration .. but then "lost" becaise of that setting -- taht's just my speculation on possible behind-the-scene behavior).

3) Because you turned that Auto-listen button green, debugger client has started listening for incoming xdebug sessions (with any ID IIRC), and this allowed you to actually debug.

Therefore -- I'd suggest choosing between two approaches -- either use Run/Debug configuration (for that set xdebug.remote_autostart=0) or use none at all (only Auto-listen button so you can debug any request at any moment).


Generally speaking (my personal experience) -- I would set xdebug.remote_autostart=0 (it's too intrusive for my liking when activated, especially when dealing with Ajax requests that got served by PHP) but still use Auto-listen method (as described in Zero-configuration article -- controlling debug session via Bookmarklet or browser extension) -- that's what I'm doing for browser-based debugging.

0

Please sign in to leave a comment.