我正在尝试让Eclipse与xdebug交谈。从xdebug日志看来,xdebug似乎正常工作(即:它正在发送它的<init>
和<response>
消息),但Eclipse没有向xdebug发送任何内容(即:no feature_set
, feature_get
等命令,如Netbeans。)
这是我的设置:
/Applications/MAMP/bin/php/php5.4.4/bin/php
/Applications/MAMP/bin/php/php5.4.4/conf/php.ini
我php.ini
的相关行是:
[xdebug]
zend_extension = "/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.default_enable = on
xdebug.remote_enable = on
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_autostart = on
xdebug.remote_handler = "dbgp"
xdebug.remote_autostart = on
xdebug.remote_mode = "req"
xdebug.remote_connect_back = on
xdebug.remote_log = /tmp/xdebuglog.log
我可以让Netbeans在端口9000上使用会话ID netbeans-xdebug
连接到xdebug,没有任何问题。请注意,当我开始调试时,它会在我的Web浏览器中打开一个新窗口,并在我正在运行的PHP文件的URL中附加?XDEBUG_SESSION_START=netbeans-xdebug
。
以下是Netbeans尝试连接时xdebug日志的片段:
Log opened at 2013-01-18 18:42:52
I: Checking remote connect back address.
I: Remote address found, connecting to ::1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Applications/MAMP/htdocs/projectname/index.php" language="PHP" protocol_version="1.0" appid="647" idekey="netbeans-xdebug"><engine version="2.2.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>
<- feature_set -i 0 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="0" feature="show_hidden" success="1"></response>
<- feature_set -i 1 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="max_depth" success="1"></response>
<- feature_set -i 2 -n max_children -v 30
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_children" success="1"></response>
<- feature_get -i 3 -n max_data
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="3" feature_name="max_data" supported="1"><![CDATA[1024]]></response>
<- stdout -i 4 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="4" success="1"></response>
<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///Applications/MAMP/htdocs/projectname/index.php" lineno="17"></xdebug:message></response>
<- stack_get -i 6
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="6"><stack where="{main}" level="0" type="file" filename="file:///Applications/MAMP/htdocs/projectname/index.php" lineno="17"></stack></response>
…
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="14" status="stopping" reason="ok"></response>
Log closed at 2013-01-18 18:47:21
在Eclipse中......
我使用默认的PHP设置在工作区中创建了一个新的PHP项目,并为源文件和公共资源创建了单独的文件夹。我在PHP Include Path步骤中没有改变任何内容,但是在PHP Build Path中,我点击了Link Source
并将/Applications/MAMP/htdocs/projectname
链接到我项目中的projectname
文件夹。
然后我按如下方式设置Eclipse首选项:
General
- &gt; Web Browser
,我已将其设置为使用外部网络浏览器(Firefox)。PHP
- &gt; Debug
- &gt; Installed Debuggers
,我已检查过XDebug是否在列表中,是否正在使用端口9000,JIT远程会话已关闭,我使用了these instructions to ensure it uses the idekey mparker17
。PHP
- &gt; Debug
,我:
http://projectname.local
)本地Web根目录(/Applications/MAMP/htdocs/projectname
)以及服务器与工作区之间的路径映射。/Applications/MAMP/bin/php/php5.4.4/bin/php
),PHP ini文件(/Applications/MAMP/bin/php/php5.4.4/conf/php.ini
),SAPI类型设置为“CLI”,PHP调试器设置为“XDebug”。Enable CLI Debug
复选框。Break at first line
复选框。在我的调试配置中,我添加了一个PHP Web应用程序并按如下方式设置它的首选项:
Server
标签中,我设置了上面创建的PHP服务器,正确设置了文件,并正确设置了URL。 以下是Eclipse尝试连接时xdebug日志的片段:
Log opened at 2013-01-18 17:33:48
I: Checking remote connect back address.
I: Remote address found, connecting to ::1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Applications/MAMP/htdocs/projectname/index.php" language="PHP" protocol_version="1.0" appid="703" idekey="mparker17"><engine version="2.2.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2013-01-18 17:33:49
这似乎向我表明Eclipse并没有与xdebug交谈,但我对为什么会发生这种情况感到难过。
答案 0 :(得分:0)
JIT远程会话已关闭
开启它。