所以 eclipse 和 xdebug 走进一家酒吧,然后我的 apache 服务器死掉了

发布于 2024-10-08 22:11:56 字数 7003 浏览 4 评论 0原文

我正在使用 windows xp x86、wamp、apache2、php 5.3 x86、eclipse php 和 xdebug,在 localhost 上作为虚拟主机和 https 虚拟主机运行

eclipse 版本信息
面向 PHP 开发人员的 Eclipse 版本:Helios 发布 Build id: 20100617-1415

我已经成功地设置了 eclipse 和 xdebug,一切都很好。

然后我必须为我的项目创建一个 svn 分支,并使用 2 个新的虚拟主机重新配置 apache,并更新我的 Windows 主机文件。

现在,当我在 Eclipse 中启动调试模式时,一切都会消失。

具体来说, 如果我没有设置断点,应用程序运行良好,除了我首先尝试调试的问题。

如果我设置一个断点,应用程序会在断点处停止,并且 Eclipse 看起来会控制住球。但是现在,当我按“继续”、“跨过”、“步入”或“打喷嚏”时,Eclipse 告诉我执行已恢复,但应用程序继续挂起,我必须重新启动 apache。

我怀疑 eclipse 和 xdebug 之间的通信存在一些中断,因为在我看来 eclipse 正在发送我的 continue 或 step over 命令,但 xdebug 没有收到它。

但即使是这样,我也不知道该怎么办。我应该去哪里寻找?

更新:
我已经成功地能够使用 notepad++ 及其 xdebug 插件进行调试,并且像穴居人一样,在 url 中输入 &XDEBUG_SESSION_START=session_name 。然而,尽管我很喜欢 npp,它的调试插件还是有很多 bug...

所以我注意到 stackoverflow 上有一个名为“phpstorm”的广告,它自称是一个轻量级但功能齐全的 php ide,具有原生 xdebug 支持。该演示需要重新启动才能工作,感觉有点像在摇摇欲坠的草稿台上工作,但它成功地很好地调试了我的小型测试应用程序和实际应用程序,这比我在 Eclipse 上能说的要多。此刻,尽管这可能是我的错。

我可能应该早点发布这个:/这是我的 phpinfo() xdebug 部分

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

这是我的 xdebug 日志文件 重现问题

日志打开于2011-01-03 08:56:22
-> <引擎
version="2.1.0"><作者><版权>

<- feature_set -i 33 -n show_hidden -v
1
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“功能集”
交易id=“33”
功能=“显示隐藏”
成功=“1”>

<- 特征集 -i 34 -n 最大深度 -v 3
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“功能集”
交易id=“34”
特征=“最大深度”
成功=“1”>

<- feature_set -i 35 -n max_children
-v 31
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“功能集”
交易id=“35”
特征=“max_children”
成功=“1”>

<- feature_get -i 36 -n 编码
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“feature_get”
交易id=“36”
功能名称=“编码”
support="1">

<- feature_get -i 37 -n 支持异步
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“feature_get”
交易ID =“37”
feature_name =“支持异步”
support="1">

<- 标准输出 -i 38 -c 1
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“stdout”transaction_id=“38”
成功=“1”>

<- stderr -i 39 -c 1
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“stderr”transaction_id=“39”
成功=“0”>

<- 断点设置 -i 40 -t 行 -f
文件:///C:%5Cxampp%5Chtdocs%5Clab%5Czf-tutorial%5Cpublic%5Cindex.php
-n 21
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“断点设置”
交易ID =“40”
id="44040001">

<-运行-i 41
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“运行”transaction_id=“41”
状态=“中断”
原因=“确定”>

<- stack_get -i 42
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“stack_get”
transaction_id="42"><堆栈
其中=“{main}”级别=“0”类型=“文件”
文件名=“文件:///C:/xampp/htdocs/lab/zf-tutorial/public/index.php”
lineno="21">

<- stack_get -i 43
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“stack_get”
transaction_id="43"><堆栈
其中=“{main}”级别=“0”类型=“文件”
文件名=“文件:///C:/xampp/htdocs/lab/zf-tutorial/public/index.php”
lineno="21">

<- eval -i 44 --
JHRoaXMtPmZpZWxkc1snYm9vbF9jb21wbGV0ZSdd
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“评估”
transaction_id="44"><属性
地址=“92404284”
type="bool">

<- eval -i 45 --
JHRoaXMtPnN0YWdlLT5nZXQoJ2Jvb2xfY29tcGxldGUnKQ==
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“评估”
transaction_id="45"><属性
地址=“92404284”
type="bool">

<- eval -i 46 --
JHRoaXMtPmZpZWxkc1snYm9vbF9jb21wbGV0ZSdd
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“评估”
transaction_id="46"><属性
地址=“92404284”
type="bool">

<- eval -i 47 --
JHRoaXMtPnN0YWdlLT5nZXQoJ2Jvb2xfY29tcGxldGUnKQ==
-> <响应 xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
命令=“评估”
transaction_id="47"><属性
地址=“92404284”
type="bool">

=== 到达断点,执行暂停。在 Eclipse 中我单击“步骤
超过”

<-step_over-i 48

=== 日志结束

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

停滞 2024-10-15 22:11:56

这篇文章听起来很有希望。

从表面上看,XDebug 和 Eclipse(在其 php 开发环境中)都可以使用 DBGp 协议。根据该文章,您可能可以通过修改 Apache 的 .htaccess 文件或运行 DBGp 代理(无论是什么)来使事情正常运行。文章中有更多详细信息。

我怀疑 XDebug 和 Eclipse 都连接到同一个 PHP 调试会话,互相踩对方的脚趾,导致随之而来的欢闹。

那或“未定义的行为”。无论哪种方式。

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.

脸赞 2024-10-15 22:11:56

woooooooooooo

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

创建新工作区使我能够成功调试。

现在,我对导致此问题的最佳猜测是在同一工作区中有两个项目,并且同一 IP 具有不同的虚拟主机。

所以我不会再这样做了。

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.

剩余の解释 2024-10-15 22:11:56

这听起来可能是一个愚蠢的问题,如果是这样,我深表歉意,但是您是否在 Eclipse 调试配置中创建了一个映射到新虚拟主机的新 PHP 服务器?

每次创建新的虚拟主机时,我通常都会创建一个全新的调试配置该配置中映射到该虚拟主机的新 PHP 服务器,以便我可以轻松地从“调试配置”下拉列表中选择它启动新会话时。

对于任何想知道的人,我通过转到“运行”->“调试配置...”,从左侧菜单中选择“PHP 网页”,单击“新建+”(如果我已经有一个,则重复),然后在在服务器选项卡上,其中显示“PHP 服务器”,我单击“新建”,然后输入文档根目录的虚拟主机的 URL。

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.

能否归途做我良人 2024-10-15 22:11:56

现在我对造成这种情况的最佳猜测是在同一工作区中有两个项目,并且同一 IP 具有不同的虚拟主机。

好吧,我也在调试两个项目,在同一个 Eclipse 工作区中,不同的 VHosts 在相同的 IP 上并使用 apache。

而且我没有遇到你的问题。

虽然我的 apache 和其他东西位于 debian 的 vmware 仿真中,而我的 Eclipse 位于 WinXP 中。

最佳

拉斐尔

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文