使用XDebug和Sublime Text的流浪者:不要停留在断点


Vagrant with XDebug and Sublime Text: don´t stop at breakpoints

我在调试Sublime Text 2,Vagrant和XDebug时遇到问题。调试不会在断点处停止

我用这个流浪盒子 https://github.com/bryannielsen/Laravel4-Vagrant

我在StackOverflow中读过很多问题,但没有一个能解决我的问题。Xdebug 成功连接到 DBGP 客户端,但不会在断点处停止,说明不要将 xdebug 用作模块,而我正在使用作为扩展。好像没问题!其他人谈论 php.ini 配置,但我的日志似乎不错

当在sublimetext(带有 https://github.com/Kindari/SublimeXdebug)中启动xdebug时,它会很好地启动网页,但sublime显示一条消息:等待执行而不是在断点处停止,网页已满载

我的 xdebug 日志看起来不错

Log opened at 2013-09-25 12:01:56
I: Checking remote connect back address.
I: Remote address found, connecting to 10.0.2.2:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/public/index.php" language="PHP" protocol_version="1.0" appid="14735" idekey="sublime.xdebug"><engine version="2.2.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2013 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-09-25 12:01:56

Sublime Text 2正在等待侦听端口9001,这是我的php.ini配置

xdebug.remote_enable=1
xdebug.remote_port=9001
xdebug.remote_autostart=0
xdebug.remote_connect_back=1
xdebug.remote_log=tmp/xdebug.log

有人有这方面的经验吗?谢谢!

我从来没有用过Sublime。(实际上,我在谷歌上搜索是否有可能,并登陆了这个页面:)

无论如何,我会尽力帮助你。我在使用 NetBeans 时遇到了类似的问题,我发现如果不指定远程主机,xDebug 将不会进行回调。这就是为什么 NetBeans 没有在任何断点处停止的原因,它只是没有从 xDebug 获得任何响应。

尝试添加到您的 php.ini:

xdebug.remote_host = 10.0.2.2

我在虚拟机上的 xdebug.ini 如下所示:

xdebug.remote_enable = On
xdebug.remote_host = 10.0.2.2

附言还要确保在执行 phpinfo() 时填充这些设置。