xdebug problem using ide key

I got the basic xdebug configuration to work using MAMP 1.9 under OS-X 10.6.3. I would like to test/debug PHP WebOrb which actually drives Flex Remoting using AMF3 - so I do not need to start the debugging session with a browser. I use "Wait for Xdebug connection with ide key" (key=phpstorm) and also configured xdebug.idekey="phpstorm" in php.ini. PhpStorm does not detect any breakpoints. Using "Open web page in browser" works. Did I misunderstand something?

Any ideas?

I also think it is confusing, that I have to set up Mappings in the server dialog and in the debug configuration under "Server paths mappings..." - the documentation states that this is only for overriding the server settings.

Thanks and Regards,
Peter

6 comments
Comment actions Permalink

If you have got it working by starting it from the IDE and now want to go the other way you could do it like this:

Since you have started it already there will already be a debugging configuration.  go and look for it in RUN->EDIT CONFIGURATIONS-> PHP on Server.

Select the debug configuration and under the 'debug' section set it to "Wait for Xdebug connection with ide key"  set that to 'PhpStorm1'.
Get the easy xdebug extension  for firefox (https://addons.mozilla.org/en-US/firefox/addon/58688/)

in firefox under TOOLS -> ADDONS -> EXTENSIONS -> EASY XDEBUG -> PREFERENCES  change the Xdebug.idekey value to 'PhpStorm1'

Set a break point in your file
click on the xdebug icon in the bottom left of firefox to turn the easy xdebug on.
click the debug button in the IDE.  (This should open the debugging panel with "Waiting for connection on port 9000 with ide key 'PhpStorm1' " in the debugger variables section.)
click the refresh button in the browser.

should stop.

One caveat is that you have to make the debugging profile for the file name that will appear in the browser.
eg:  if you have index.php which includes counter.php and you want to debug counter.php then you need to make the debug profile for index.php.

0
Comment actions Permalink

Hello Peter,

Thank you for your feedback,

To handle breakpoints correctly, PhpStorm needs a mapping between local path on client machine (where IDE is running) and local path on server filesystem.
PhpStorm tries to autodetect it basing on the mappings between local path, deploy path and web path that you set up at Settings | Deployment panel (Mappings tab). In case it's unable you can specify this mapping at 'Override Server Path Mappings' dialog. You typically have to do it only if 'Failed to detect server paths mappings' balloon appears when you start debugging, otherwise you just keep that table empty.

Can you please provide screenshots of your Server and Mappings tabs and your run confiugration?

Thanks,
Kirill

PS Sure we see current workflow is complex and somewhat inconveient, so we're  currently working on improvements in this area.

Added: you can also try enabling 'Break at the first line' option to check whether it breaks at all.

0
Comment actions Permalink

Hello Michael,

Thanks for the hint, but as far as I understand the problem is that PhpStorm has no (or invalid) mappings, so it tries to register breakpoints at unexisting files.

Kirill

0
Comment actions Permalink

Hello Kirill,

maybe I was not clear enough in my first post. I got everything to work with breakpoints when I use the option "Open web page in browser" in the debug configuration dialog / Debug (see attachment 1). so I assume that the server path mappings are correct. My usecase: I am debugging a PHP WebOrb server component which feeds my Flex client via AMF3 service requests (started from IDEA) - this means that the PHP data never feeds a real HTML page. So I would like to start the debugger using the option "Wait for Xdebug connection with ide key", so PhpStorm silently starts the debugger (without popping up a dummy page) and waits for the Flex client to trigger some activity involving any of the project associated PHP classes. The php.ini file is configured like this:

[xdebug]
zend_extension="/Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=true
xdebug.idekey="PhpStorm1"

[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/Applications/MAMP/bin/php5.2/zend/lib/Optimizer-3.3.9
zend_optimizer.version=3.3.9

;zend_extension=/Applications/MAMP/bin/php5.2/zend/lib/ZendExtensionManager.so


I assumed that using the ide key option serves exactly this purpose - is this correct?

Thanks and Regards,
Peter


Attachment(s):
PhpStorm-2.png
PhpStorm-1.png
0
Comment actions Permalink

Finally I got it to work by configuring php.ini like this:

[xdebug]
zend_extension="/Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=PhpStorm1

[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/Applications/MAMP/bin/php5.2/zend/lib/Optimizer-3.3.9
zend_optimizer.version=3.3.9

;zend_extension=/Applications/MAMP/bin/php5.2/zend/lib/ZendExtensionManager.so

Thanks and Regards,
Peter

0
Comment actions Permalink

Hello Peter,

Thanks, now I see there was likely no problem with mappings, Xdebug just was not connecting to the IDE, and you've successully fixed it enabling remote_autostart option.

As far as I see Easy Xdebug would not help in this case since you're making a request from Flex application. The only alternative to remote_autostart I can imagine is to patch the remoting part at the Flex side so that in sets up xdebug cookie (or, includes certain parameter in the query URL), but I'm not sure it's technically possible.

Thanks,
Kirill

0

Please sign in to leave a comment.