Strange issue with xDebug in PHPStorm on Mountain Lion

Hey,

First of all let me welcome you. I'm new to the forums.

I'm using Mac osx Mountain Lion, and MAMP Pro.

MAMP Pro is using PHP 5.4.10. I have the following lines in by php.ini regarding Xdebug, and phpinfo() shows, that xdebug is enabled.

[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.default_enable=1
xdebug.coverage_enable=1
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "/tmp"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_log=/tmp/xdebug.log

Recently I've tried to install PEAR and phpunit and phpcs ( CodeSniffer ) for IntelliJ. But this somehow introduced an issue in debugging.

Now image that I'm starting my computer. Running PHPStorm and MAMP and enable listening to xdebug incoming connections. From my terminal I'm running phpcs, and PHPStorm catches this connection to debug phpcs, which is strange.

I stop the debug process.

I put breakpoint in the code and open my page defined as local.myapp.com. PHPStorm correctly catches the breakpoint and I can debug the app. I stop the debug process and refresh the page.

Now everything is freezed. The page does not load, debugger in PHPStorm says that I'm disconnected. Nothing really happens.

As soon as I disable listening to php debg connections everything is fine. The page works as expected.

To be able to debug again I need to restart my computer.

Then I can do debug one time and the situation repeats itself.

If you need anything from me please let me know.

I don't know what may be necessary for you to help me, but your help would be grately appreciated.

Jakub

5 comments

Hi there,

You have xdebug.remote_autostart=1 -- this tells xdebug to connect to debug client (PhpStorm in our case .. or whatever other who lsitens on xdebug port) on EVERY SINGLE php script execution, be it web page or CLI mode (that's in case your PHP uses the same php.ini for both of them).

Yes -- you will see a delay on every request (about 1sec, I woul dsay) while xdebug attempts to connect to debug client. Why it freezes -- cannot say. But yes -- while PhpStorm is listening for debug connections (the "phone handle" button), it will be replying to every such request.

I suggest checking xdebug manuals and maybe configure xdebug a bit differently.

Useful links:

0

Hey Andriy,

I've removed this setting for xdebug.

Restarted IDE and MAMP, but it didn't help.

Still the same issue, maybe I could provide with more detail, but it would be good if you could point me into correct direction.

I've tried using this: http://www.jetbrains.com/phpstorm/marklets/ but actualy don't know what to do with it.

When I run debug from IDE my browser opens with this link:
http://local.app/?XDEBUG_SESSION_START=18552
and debugger says: "Waiting for incoming connection with ide key '18552'

Then I need to change page to different URL.

Page reloads, but hangs ( just as if it entered break point ) So I go to IDE

I can see that breakpoint icon has changed its state to "checked", debugger says "connected"

But console says nothing, and I cannot do anything.

I've attached xdebug.log

They say more - I can see that ajax is connecting to debugger - at least I suppose so, but don't know what to do with it. :(

And attached also is screenshot from IDE with buttons disabled.



Attachment(s):
xdebug.log.zip
Screen Shot 2013-06-20 at 2.34.10 PM.png
0

It's hard for me to tell what else could be wrong here -- I just pointed to the most obvious issue that I have spotted. Can you check what php.ini you have edited? Maybe there is more than one (one for CLI and one for web requests)? You can see what file you are using from phpinfo() -- header section.

I've tried using this: http://www.jetbrains.com/phpstorm/marklets/ but actualy don't know what to do with it.

It's used to trigger xdebug session (ON or OFF etc) manually -- the usage is desribed in that zero configuration article a bit.

When I run debug from IDE my browser opens with this link:
http://local.app/?XDEBUG_SESSION_START=18552

If you are using this approach, then you do not need to use bookmarklets.

But I still recommend using approach described in that zero configuration article (the link I gave in my first reply) -- it always worked for me with no issues (lucky me? MS Windows power!!).

Another link to check (in case you have not seen it yet -- it may be useful): 5 Step Tutorial: PHPStorm + MAMP PRO 2

Anyway:
1) From xdebug log -- I see that there were simultaneous sessions started at the same time -- maybe it's causing the issue? You can increase limit of concurrent debug sessions to 2 or 3 (from default 1) at "Preferences | PHP | Debug --> Max simultaneous connections"

2) You can also tick "Ignore external connections trough unregistered server configurations" -- this should ignore requests from different domain/host name  (or no host name at all) -- that's in case if toy have such "outside of the project" connections

3) You can also try resetting project configuration in case it is somehow corrupted and does not allow to debug (but I do not think it;'s the reason here). In any case: 1) close project in IDE; 2) backup and delete (or just rename) .idea subfolder in project root (project settings are stored there); 3) In IDE use "File | Open Directory" to open that project and configure it from scratch -- maybe it will do better this time (but, once again, quite unlikely)

0

Hey, looks like the issue has been partially fixed.

I've went through the tutorial you provided. And did one change in php.ini, which is presumaby CLI version.

And increased max connections to 3.

I've tested and it hit the breakpoint. Refreshed and it hit it again. Refreshed - nothing.

I have increased it to 10.

Maybe there's some issue with timeout or ending session by xdebug or IDE.

I will look for more info, but for now it is better than before.

Thank you

0

Maybe you still debugging previous session (breakpoint is hit .. but you just do not see it) ??

Do you see extra tabs in Debugger panel .. or just one (like it is shown on your screenshot -- "Debug <icon> Project" ) ? If unsure -- post a screenshot after few of such "refreshes".


Regarding "session expiration":  session is not getting terminated automatically like in CLI mode (since in CLI mode whole process dies) -- if cookie is still there (the bookmarklet works via cookies) the xdebug will still see it until it is expired ... or you use "Stop Debug" bookmarklet (which simply removes cookie). See if clearing XDEBUG_* cookies for that domain help (can be done in firebug .. or dev tools of your browser).

P.S.
You can also try upgrading your xdebug to the latest 2.2.3 version (as far as I understand you currently using 2.2.1) -- maybe it has some issues that were fixed since then.

0

Please sign in to leave a comment.