問題描述
我安裝了 Xdebug 2.1,并運行 PHP 5.2.13.它可以成功連接到多個 DBGP 客戶端(即 xdebug.remote_log
顯示來回通信,客戶端本身也顯示傳入連接),但它不會在斷點處停止.我試過 NetBeans、MacGDBp 以及命令行debugclient
與 Xdebug 捆綁在一起.
I have Xdebug 2.1 installed, and running with PHP 5.2.13. It can successfully connect to multiple DBGP clients (i.e. the xdebug.remote_log
shows communication back and forth, and the clients themselves also show the incoming connection), but it doesn't stop at breakpoints. I have tried NetBeans, MacGDBp and also the command-line debugclient
bundled with Xdebug.
一個典型的交換看起來像:
A typical exchange looks like:
Log opened at 2010-07-20 09:33:17
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/hgfs/htdocs/mycompany/index.php" language="PHP" protocol_version="1.0" appid="14371" idekey="macgdbp"><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>
<- status -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="macgdbp" status="starting" reason="ok"></response>
<- step_into -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="macgdbp" status="stopping" reason="ok"></response>
<- status -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="macgdbp" status="stopping" reason="ok"></response>
Log closed at 2010-07-20 09:33:18
NetBeans 嘗試設置斷點,Xdebug 確認這些斷點:
NetBeans attempts to set breakpoints, and these are acknowledged by Xdebug:
<- breakpoint_set -i 7 -t line -s enabled -f file:///mnt/hgfs/htdocs/mycompany/index.php -n 9
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="7" state="enabled" id="139360004"></response>
然而,Xdebug 還是不肯罷休!
However, Xdebug still refuses to stop!
推薦答案
如果您將 Xdebug 作為 extension
加載(即 extension=xdebug.so
) 在 PHP 配置中而不是 zend_extension
(即 zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so
).
This appears to happen if you have have Xdebug loaded as an extension
(i.e. extension=xdebug.so
) in the PHP config instead of a zend_extension
(i.e. zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so
).
確保您的 PHP 配置中沒有 extension=xdebug.so
行任何地方,即使您是非常確定您正在使用 zend_extension
.例如,如果您在 /etc/php5/conf.d/xdebug.ini
中有 zend_extension
,這很可能會被 extension
取代在 /etc/php5/apache2/php.ini
中.如果是這種情況,什么都不會抱怨,phpinfo()
會盡職盡責地報告 Xdebug 已加載!(Xdebug 2.1 在作為擴展加載時確實會在 phpinfo()
中發出一個小警告,但以前的版本什么也不做.)
Make sure that you don't have an extension=xdebug.so
line anywhere in your PHP config, even if you're pretty sure you're using zend_extension
. For example, if you have zend_extension
in /etc/php5/conf.d/xdebug.ini
, this may well be superseded by an extension
in /etc/php5/apache2/php.ini
. If this is the case, nothing will complain, and phpinfo()
will dutifully report that Xdebug is loaded! (Xdebug 2.1 does issue a small warning in phpinfo()
when loaded as an extension, but previous versions do nothing.)
這篇關于Xdebug 成功連接到 DBGP 客戶端,但不會在斷點處停止的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!