46

I am using windows xp x86, wamp, apache2, php 5.3 x86, eclipse php, and xdebug, running on localhost as both a virtualhost and an https virtualhost

eclipse version info
Eclipse for PHP Developers Version: Helios Release Build id: 20100617-1415

I had successfully managed, somehow, to setup eclipse and xdebug and all was well.

Then I had to make an svn branch of my project, and reconfigure apache with 2 new virtual hosts, and update my windows host files.

Now when I launch debug mode in eclipse everything dies.

Specifically, If I set no breakpoints the app runs fine, save for the problem I'm trying to debug in the first place.

If I set a breakpoint, the app stops at the breakpoint, and eclipse appears to be holding the ball. But now, when I press continue, or step over, or step into, or sneeze, eclipse tells me execution has resumed, but the application continues to hang, and I have to restart apache.

I suspect that there is some break in the communication between eclipse and xdebug, because it looks to me like eclipse is sending my continue or step over command, but xdebug is not receiving it.

But even if that's the case I don't know what to do about it. Where should I be looking?

Update:
I have successfully been able to debug using notepad++, its xdebug plugin, and, like a caveman, typing &XDEBUG_SESSION_START=session_name into the url. However, despite my love for npp, its debug plugin is quite buggy...

So I noticed an ad on stackoverflow for something called "phpstorm", which professed to be a lightweight yet full featured php ide, with native xdebug support. The demo required a restart to get it to work, and it feels kind of like working on a wobbly draft table, but it managed to debug both my small test app and real app very nicely, which is more than I can say for eclipse at the moment, even though its probably my fault.

I probably should have posted this earlier :/ Here is my phpinfo() xdebug section

xdebug
xdebug support  enabled
Version     2.1.0

Supported protocols Revision
DBGp - Common DeBuGger Protocol     $Revision: 1.145 $

Directive   Local Value Master Value
xdebug.auto_trace   Off Off
xdebug.collect_assignments  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.file_link_format no value    no value
xdebug.idekey   no value    no value
xdebug.manual_url   http://www.php.net  http://www.php.net
xdebug.max_nesting_level    100 100
xdebug.overload_var_dump    On  On
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  C:\xampp\tmp    C:\xampp\tmp
xdebug.profiler_output_name xdebug_profile.%p   xdebug_profile.%p
xdebug.remote_autostart Off Off
xdebug.remote_connect_back  Off Off
xdebug.remote_cookie_expire_time    3600    3600
xdebug.remote_enable    On  On
xdebug.remote_handler   dbgp    dbgp
xdebug.remote_host  localhost   localhost
xdebug.remote_log   c:\xampp\apache\logs\xdebug.log c:\xampp\apache\logs\xdebug.log
xdebug.remote_mode  req req
xdebug.remote_port  9000    9000
xdebug.scream   Off Off
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 C:\xampp\tmp    C:\xampp\tmp
xdebug.trace_output_name    trace.%c    trace.%c
xdebug.var_displ

 ay_max_children    128 128
 xdebug.var_display_max_data    512 512
 xdebug.var_display_max_depth   3   3

Here is an xdebug log file of when I reproduce the problem

Log opened at 2011-01-03 08:56:22
-> <init xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
fileuri="file:///C:/xampp/htdocs/lab/zf-tutorial/public/index.php"
language="PHP" protocol_version="1.0"
appid="4404"
idekey="ECLIPSE_DBGP"><engine
version="2.1.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick
Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright
(c) 2002-2010 by Derick
Rethans]]></copyright></init>

<- feature_set -i 33 -n show_hidden -v
1
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="feature_set"
transaction_id="33"
feature="show_hidden"
success="1"></response>

<- feature_set -i 34 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="feature_set"
transaction_id="34"
feature="max_depth"
success="1"></response>

<- feature_set -i 35 -n max_children
-v 31
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="feature_set"
transaction_id="35"
feature="max_children"
success="1"></response>

<- feature_get -i 36 -n encoding
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="feature_get"
transaction_id="36"
feature_name="encoding"
supported="1"><![CDATA[iso-8859-1]]></response>

<- feature_get -i 37 -n supports_async
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="feature_get"
transaction_id="37"
feature_name="supports_async"
supported="1"><![CDATA[0]]></response>

<- stdout -i 38 -c 1
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="stdout" transaction_id="38"
success="1"></response>

<- stderr -i 39 -c 1
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="stderr" transaction_id="39"
success="0"></response>

<- breakpoint_set -i 40 -t line -f
file:///C:%5Cxampp%5Chtdocs%5Clab%5Czf-tutorial%5Cpublic%5Cindex.php
-n 21
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="breakpoint_set"
transaction_id="40"
id="44040001"></response>

<- run -i 41
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="run" transaction_id="41"
status="break"
reason="ok"><xdebug:message
filename="file:///C:/xampp/htdocs/lab/zf-tutorial/public/index.php"
lineno="21"></xdebug:message></response>

<- stack_get -i 42
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="stack_get"
transaction_id="42"><stack
where="{main}" level="0" type="file"
filename="file:///C:/xampp/htdocs/lab/zf-tutorial/public/index.php"
lineno="21"></stack></response>

<- stack_get -i 43
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="stack_get"
transaction_id="43"><stack
where="{main}" level="0" type="file"
filename="file:///C:/xampp/htdocs/lab/zf-tutorial/public/index.php"
lineno="21"></stack></response>

<- eval -i 44 --
JHRoaXMtPmZpZWxkc1snYm9vbF9jb21wbGV0ZSdd
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="eval"
transaction_id="44"><property
address="92404284"
type="bool"><![CDATA[-1]]></property></response>

<- eval -i 45 --
JHRoaXMtPnN0YWdlLT5nZXQoJ2Jvb2xfY29tcGxldGUnKQ==
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="eval"
transaction_id="45"><property
address="92404284"
type="bool"><![CDATA[-1]]></property></response>

<- eval -i 46 --
JHRoaXMtPmZpZWxkc1snYm9vbF9jb21wbGV0ZSdd
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="eval"
transaction_id="46"><property
address="92404284"
type="bool"><![CDATA[-1]]></property></response>

<- eval -i 47 --
JHRoaXMtPnN0YWdlLT5nZXQoJ2Jvb2xfY29tcGxldGUnKQ==
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="eval"
transaction_id="47"><property
address="92404284"
type="bool"><![CDATA[-1]]></property></response>

=== breakpoint reached, execution pauses.  In eclipse I click "step
over"

<- step_over -i 48

=== end of log
Ethan Bierlein
  • 3,353
  • 4
  • 28
  • 42
Matt
  • 3,778
  • 2
  • 28
  • 32
  • I can't really help, but I had a similar problem with xdebug crashing eclipse/resuming randomly. It still happens from time to time, but I'm not sure why. I'll be interested to see the answer. Oh, and +1 for the refreshing humor :D – Craige Dec 22 '10 at 13:50
  • 36
    +1 for the title, and if anyone edits it, lemme know and I'll revert it for you (or get it reverted `;)` ) ~~~ As for the actual problem, idk, but it sounds like you know where the break is (between eclipse and xdebug) ... I don't use eclipse/apache so I can't help you, but wish you luck. – jcolebrand Dec 22 '10 at 14:19
  • 2
    1. I dislike PHPStorm. I found it clunky and unusable. 2. Are you using 32bit or 64bit Eclipse, and of which release? 32bit or 64bit PHP, and of which release? – Craige Dec 22 '10 at 17:59
  • 1
    I assume you've tried resetting PHP/XDebug settings to default and configuring from scratch? If you do that then at least you can nail down that it's not your XDebug config which is causing the prob. Then try resetting Apache host settings and add ONLY your active program as a virtual host, debug your program, then add in the others later (depends how many other things you have running off it as to whether it's feasible to have extended downtime while you do this). In the same vein, try creating a new Eclipse project tied to your program and run it in debug to see if it's Eclipse's settings. –  Dec 23 '10 at 02:26
  • I have absoultely no idea how to help you but I do love questions that mix in some good humor (with an actual question of course). solidary +1 – Trufa Dec 23 '10 at 02:34
  • @darvids0n That was on my list of things to try. Since I got it to work with 2 different debug clients other than eclipse, I'm inclined to think my server settings are correct. – Matt Dec 23 '10 at 08:47
  • 3
    xdebug used to have issues with curl PHP extension on Windows. If you have it enabled, try disabling it to see if it helps. – Mchl Dec 23 '10 at 08:56

4 Answers4

2

This article sounds promising.

Both XDebug and Eclipse (in its php dev env) can use the DBGp protocol by the look of things. Based on that article, you might be able to get things working by messing with Apache's .htaccess file[s], or by running a DBGp proxy (whatever that is). Further details in the article.

I suspect both XDebug and Eclipse are connecting to the same PHP debug session, stepping on one anothers toes, causing Hilarity to Ensue.

That or "undefined behavior". Either way.

Mark Storer
  • 15,672
  • 3
  • 42
  • 80
  • Aren't xdebug and the ide supposed to connect to the same debug session? If not, is there a simple way to test if this is the case? I don't think its the multiple client issue, since I can connect with other debugers. – Matt Dec 29 '10 at 09:03
  • I'm guessing. To be sure, try disabling PHP debugging within Eclipse. It's also possible that Apache uses similar debugging mechanisms for PHP and whatever-else-eclipse-debugs, and those two things are getting tangled. PS: Is this an XDebug plugin within eclipse, or a separate app? It looks like there IS an XDebug plugin, but if you're not using it, that could be the issue. – Mark Storer Dec 29 '10 at 17:41
2

wooooooooooooo

https://bugs.eclipse.org/bugs/show_bug.cgi?id=312951#c8

Creating a new workspace allows me to debug succesfully.

Right now my best guess as to what caused this is having two projects in the same workspace with different vhosts at the same ip.

So I aint not gonna do that no more.

Matt
  • 3,778
  • 2
  • 28
  • 32
  • So, how exactly does this work? Do you have separate folders in your web root you are using as workspaces? I can't seem to get this to fix my problem. – thaddeusmt Jan 07 '11 at 17:28
  • Each webapp has its own webroot, which is configured as an apache virtual host. I created a new eclipse workspace, then new project, create from existing source, and selected the webroot of the particular app. – Matt Jan 10 '11 at 08:50
1

This may sound like a silly question, and I apologize if so, but did you create a new PHP Server inside of your Eclipse Debug Configuration that maps to your new virtual host?

Every time I create a new vhost, I usually create a totally new Debug Configuration and a new PHP Server within that configuration that maps to the vhost, so that I can easily select it from the Debug Configs drop down when launching a new session.

For anyone wondering, I do this by going to Run->"Debug Configurations...", select "PHP Web Page" from the menu on the left, click new+ (or duplicate if I already have one), and then under the Server tab, where is says "PHP Server", I click "New" and then type in the URL of the vhost for the document root.

  • Not silly, but yes I have done this. I have a vhost for both the actual work application, and a vhost for my lab/sandbox, debug configurations for each, and I have the same problem with each – Matt Jan 05 '11 at 08:54
1

Right now my best guess as to what caused this is having two projects in the same workspace with different vhosts at the same ip.

Well I am debugging as well two projects, in the the same Eclipse-workspace with different VHosts at the same IP and use apache.

And I am not experiencing your problems.

Though my apache and stuff is located in a vmware-emulation of debian and my Eclipse resides in WinXP.

Best

Raffael

Raffael
  • 19,547
  • 15
  • 82
  • 160