Xdebug does not work (waits for connection)

Hi,

I'm trying to setup xdebug with PhpStorm and it won't work... it did work with NetBeans and Eclipse before, so there needs to be some configuration error in my PhpStorm settings.

All of this runs on the same machine, so the project folder does not need to be synced.

My settings:
http://dl.dropbox.com/u/256059/tmp/phpstorm/deployment.jpg
http://dl.dropbox.com/u/256059/tmp/phpstorm/debug_config_1.jpg
http://dl.dropbox.com/u/256059/tmp/phpstorm/debug_config_2.jpg

xdebug log: http://pastebin.ca/1960751

According to the xdebug log PhpStorm and xdebug DO communicate - they even exchange the breakpoints, but except of this nothing happens... PhpStorm stays in the "Waiting for connection on port 9000 with ide key 'PhpStorm'"-mode.

I tried this in the newest EAP and in the stable. Both didn't work.

Edit: Added some more tags after solving the problem

13 comments
Comment actions Permalink

Hi Sven,

On screenshot #3 I see that you have "Wait for connection with ide key" option selected. This means that debugging session must be initiated manually from outside PhpStorm -- from your browser.

If you want to start debugging from within PhpStorm (for that specific page) -- just choose "Open web page in browser" option instead. It will launch the page in browser and initiate debugging session automatically. Make sure that you have at least one breakpoint setup or "Break at the first line" option selected, otherwise debugger will not kick in (as there is no reason for debug) -- this goes for both options -- this and below.

If you want use "Wait for connection with ide key" option (which will allow you to debug complex applications much easier IMO, for example those that have SEO friendly URLs as well as specific scrip execution scenarios (where script parameters matters a lot) ) -- then you have to initiate session from outside. I see you use Chrome browser. Here is extension which I use myself -- does the job perfectly: Xdebug helper https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc -- very easy to configure and use. But you may use another extension if you wish (I remember seeing more than one). Similar extensions exist for Firefox as well.

0
Comment actions Permalink

Hi Andriy,

I did that on purpose. I already use the extension you mentioned and if you take a look at the xdebug log you can see that the debug session is indeed initiated by the browser.

I also tried the other debug method your described and it does the same... the log shows that PhpStorm and xdebug communicate and PhpStorm itself does nothing but waiting for a connection.

0
Comment actions Permalink

Hi Sven,

I saw the log -- but could not make anything useful of it (I'm not a JB dev and have not seen any xdebug-PhpStorm logs before, so it's difficult for me to judge how successful it is).

By looking at the log I have found one thing which attarcted my attention:

file:///E:/Entwicklung/htdocs/<deleted by author>/account_cashpoints.php

and

file:///W:/<deleted by author>/account_cashpoints.php


I guess it's the same file -- but they are on different drives (E and W) -- do you use some symbolic link/junction point or drive mapping ?? I personally pretty sure that is the reason. Can you setup your project so that all files are on the same drive (at least temporarily ... or create an empty project with very simple php script -- easier) and run debug there ?

0
Comment actions Permalink

Hi Andriy,

right after my answer I also noticed that. I do indeed use NTFS symlinks (W: is an encrypted truecrypt volume for company projects)

After setting an override from W:\... to E:\Entwicklung\... everything works.
I wonder why I didn't notice this as I edited the project names out of the paths...

Thats what I get for using advanced filesystem functions! ;)

0
Comment actions Permalink

Hello all,

Just to confirm Andriy's answer, the problem was with symbolic links you use. Unfortunately, they are sometimes handled incorrectly (http://youtrack.jetbrains.net/issue/WI-600).

Current workaround is to provide debugging path overrides in 'PHP on server' run configuration dialog -> Debug -> 'Server path mappings' dialog:

local path on client = W:/, local path on server = E:/Entwicklung/htdocs

Regards,
Kirill

PS Gratitude to Andriy for his answers, we appreciate that! :)

0
Comment actions Permalink

Hi,

I have similar problems as well. The debugger does not jump to the breakpoint when I launch my URL that contains the swf that communicates to the remote services. I have a Flex remoting setup with amfphp where it is not possible to trigger the debugger by launching an HTML page from PHPStorm, so I use an ide key of "PhpStorm1", that is also in my MAMP php.ini:

[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

What I'm trying to figure out is how should I set up my configuration. Here's my simple setup:

File to trigger the debugger (this is the client running on the localhost:8888):
Applications/MAMP/htdocs/project/folder1/folder2/folder3/folder4/folder5/pageContainingSWF.php

File to debug (this is the php file that retrieves data from the db):
Applications/MAMP/htdocs/services/remote.php

I tried many configurations with PHP On Server option, but none of them work. I would love to see it work either with PhpStorm or IDEA. I know it's possible because some people on this forum have already done it. Please advice, as I have run out of ideas ;-)

Thanks in advance,

Tim

0
Comment actions Permalink

Hello Timur77,

It looks like you have a problem with xdebug installation. Have you tried "validate xdebug before run" option?
You can also examinate phpinfo() output - it should contain 'XDebug' section.

0
Comment actions Permalink

Hello Nokolay,

Unfortunately I have validate xdebug before run option checked and  phpinfo() output contains:

xdebug

xdebug support enabled
Version 2.0.5

Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision:  1.125.2.6 $
GDB - GNU Debugger protocol $Revision:  1.87 $
PHP3 - PHP 3 Debugger protocol $Revision:  1.22 $

Directive Local Value Master  Value
xdebug.auto_trace Off Off
xdebug.collect_includes On On
xdebug.collect_params 0 0
xdebug.collect_return Off Off
xdebug.collect_vars Off Off
xdebug.default_enable On On
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.extended_info On On
xdebug.idekey timmyk PhpStorm1
xdebug.manual_url http://www.php.net http://www.php.net
xdebug.max_nesting_level 100 100
xdebug.profiler_aggregate Off Off
xdebug.profiler_append Off Off
xdebug.profiler_enable Off Off
xdebug.profiler_enable_trigger Off Off
xdebug.profiler_output_dir /tmp /tmp
xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
xdebug.remote_autostart On On
xdebug.remote_enable On On
xdebug.remote_handler dbgp dbgp
xdebug.remote_host localhost localhost
xdebug.remote_log no value no value
xdebug.remote_mode req req
xdebug.remote_port 9000 9000
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.show_mem_delta Off Off
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.trace_output_dir /tmp /tmp
xdebug.trace_output_name trace.%c trace.%c
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3



As I've said, I can't think of anything else.

Tim

0
Comment actions Permalink

Timur77,

I noticed the following in your settings - you have different Local and Master Values for xdebug.idekey settings.(Look at attached picture).

Please try to set ide key setting in PhpStorm to "timmyk".



Attachment(s):
xdebug_idekey_local_value.png
0
Comment actions Permalink

THAT'S IT!!! It worked. Wow, thanks a million! OK, next question, if I got this to work in PhpStorm, will this be possible in IDEA 10? Since I work with Flex & PHP, IDEA would be a more flexible approach.

Tim

0
Comment actions Permalink

Basically yes. But IDEA 10 release has almost the same PHP plugin as PhpStorm 2.0 EAP 98.521 - and its lacking some of recent features that you was just taught to use. It will get updated PHP plugin in 10.0.x releases/EAP builds.

0
Comment actions Permalink

Do you mean features like "Wait for Xdebug connection with ide key:"? It seems it was available in IDEA 9.x.x in one of the videos, but then was removed. Is there an ETA on the update for IDEA PHP plug in?

Thanks,

Tim

0
Comment actions Permalink

Nope, I mean all what you can see *now* in PhpStorm 2.0 EAP. 9.0.x has only PhpStorm 1.0 features.
No ETA.

You can roughly compare build features by full build numbers: 98.521 (Prev 2.0 EAP)  > 99.14 (IDEA X) > 100.36 (Current 2.0 EAP)

0

Please sign in to leave a comment.