Home » Php » php – So eclipse and xdebug walk into a bar, and then my apache server dies

php – So eclipse and xdebug walk into a bar, and then my apache server dies

Posted by: admin April 23, 2020 Leave a comment

Questions:

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
How to&Answers:

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.

Answer:

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.

Answer:

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.

Answer:

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