Xdebug 忽略断点
我目前正在尝试让 Xdebug 在我们的开发服务器上工作。作为客户端,我使用的是 netbeans,到目前为止连接工作没有问题。 但是当我尝试在 netbeans 中设置断点时,它只是被忽略。
是的,我已经在谷歌上搜索了几个小时,还在这里发现了一些完全符合我的描述的问题: SO 1 SO 2
但这并不似乎为我解决了。 Xdebug
模块通过 zend_extension=path/to/xdebug 加载。所以在
/etc/php5/conf.d/xdebug.ini
中,我还查看了 php5/apache 和 php5/cli php.ini 以确保它不是在某处加载了扩展名=。我还检查了 phpinfo() 找到的“解析的其他 .ini 文件”,它似乎没有在其他地方加载。
中看到加载的 Xdebug 模块
通过执行 php -m 我可以在[PHP Modules]
和
[Zend Modules]
不确定这是否表明它仍然加载了两次这样可以吗?不过,如果我从 conf.d/xdebug.ini
中删除 zend_extension=/path/to/xdebug.so
,它也不再是已加载。所以我真的假设它只加载到那里。
如果我设置了remote_log选项,就会看到Netbeans
正在尝试设置一些东西:
<- breakpoint_set -i 452 -t line -s enabled
-f file:///http:/development.xxx.de/users/itsame/index.php -n 15
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set"
transaction_id="452" state="enabled" id="258870001">
</response>
但它似乎没有效果(看起来与我上面发布的其他SO问题几乎相同。但是如果我在 php 代码中执行手动 xdebug_break() 可以正确处理它,
PHP 版本是 5.2.6,Xdebug 是 2.1。 有什么建议我接下来可以去哪里看看吗?
I am currently trying to get Xdebug to work on our development server. As client I am using netbeans and the connection so far works without problems.
But when I try to set a breakpoint within netbeans it is just getting ignored.
And yeah, I already googled for hours and also found some questions here that perfectly fit my description:
SO 1
SO 2
But this does not seem to solve it for me. The Xdebug
module is loaded via zend_extension=path/to/xdebug. so in the
/etc/php5/conf.d/xdebug.ini
I also looked at the php5/apache and php5/cli php.ini to make sure it is not loaded with extension= somewhere there. I also checked the "additional .ini files parsed" found by phpinfo() and it seems to be nowhere else loaded.
By executing php -m I can see the loaded Xdebug module in
[PHP Modules]
and in
[Zend Modules]
Not sure if this indicates that it is still loaded twice or if it is fine like that? Still if I remove the zend_extension=/path/to/xdebug.so
from the conf.d/xdebug.ini
it is also no longer loaded. So I really assume it is only loaded there.
If I set the remote_log option is see that Netbeans
is trying to set something:
<- breakpoint_set -i 452 -t line -s enabled
-f file:///http:/development.xxx.de/users/itsame/index.php -n 15
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set"
transaction_id="452" state="enabled" id="258870001">
</response>
But it seems to have no effect (looks pretty much the same like in the other SO questions I have posted above. But if i do a manual xdebug_break() inside the php code it handels it properly.
PHP Version is 5.2.6 and Xdebug is 2.1.
Any suggestions where I could have a look next?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
看起来包含断点的文件的路径有问题。
我在 Eclipse 中也遇到过类似的问题。仅接受索引文件中的断点,而忽略索引中包含的其他文件中的断点。
我查看了remote_log 文件并看到以下内容:
我注意到断点的路径全部错误。结果我必须在 Eclipse 中设置端口映射。设置正确的映射后,断点开始工作。另外,我的 Remote_log 现在显示了正确的路径:
我不确定 Netbeans 中是否存在与 Eclipse 端口映射配置等效的内容,但希望我为您指明了正确的方向。
It looks like there is something wrong with the path to the file containing the breakpoint.
I've had a similar problem with Eclipse. Only my breakpoints in the index file were accepted and breakpoints in other files—that were included in the index—were ignored.
I looked in the remote_log file and saw the following:
I noticed that the path for the breakpoint was all wrong. It turned out that I had to setup Port Mapping in Eclipse. After setting the correct mapping the breakpoints started working. Also my remote_log now shows the correct path:
I'm not sure if there is an equivalent of the Eclipse Port Mapping configuration in Netbeans, but hopefully I pointed you in the good direction.
对我来说,问题是“项目属性 > 源 > Web 根目录:”未设置(它有一个默认值“)。
将其设置为磁盘上的 Web 根目录后,断点开始工作。
For me the problem was "Project properties > Source > Web Root:" was not set (it had a default " as its value).
After setting it to be my web root on disk, the breakpoints started working.
在您的 php.ini 文件中,设置此指令:
我希望这对某人有帮助?
In your php.ini file, set this directive:
I hope this help someone?
转到:
项目>属性>运行配置>高级(按钮)
如果您不使用 Xdebug 进行远程调试,请从“路径映射”中删除所有映射。这将有助于解决这个问题。
Go to:
Project > Properties > Run Configuration > Advanced (button)
Remove all the mappings from the "Path Mapping" if you are not using Xdebug for remote debugging. This would help to fix this issue.
问题提到 xdebug.ini 文件存在,但未报告其内容。
我的默认安装文件仅包括:
但为了真正进行调试,必须启用它。添加此行:
然后
phpinfo()
将报告正常运行的 xdebug:The question mentioned that the xdebug.ini file exists, but does not report its contents.
My default installation's file only included:
But in order for debugging to actually happen, it must be enabled. Add this line:
Then
phpinfo()
will report a functioning xdebug:我遇到了这篇文章,试图解决 eclipse 中的 xdebug 问题,而不是在 Web 应用程序的断点处中断。我发现这里的评论非常有用。另外,这篇文章 http://www.devside .net/wamp-server/netbeans-waiting-for-connection-netbeans-xdebug-issue 非常方便地解决我的问题。我只需在相关的 php.ini 中设置以下标志即可。
xdebug.remote_enable=1
xdebug 将持续等待会话,但在设置远程调试标志后,会话等待问题、断点问题以及我定义的 xdebug 日志文件也开始记录事务。
I came across this post trying to solve my xdebug problem in eclipse not breaking at break points for a web application. I found the comments herein very useful. Also, this post http://www.devside.net/wamp-server/netbeans-waiting-for-connection-netbeans-xdebug-issue came in very handy to solve my issue. I just had to set the following flag in my relevant php.ini.
xdebug.remote_enable=1
xdebug would continuously wait on the session but after setting the remote debug flag the session wait issue, breaking point issue as well the xdebug log file that I had defined also started logging transactions.
在尝试了这篇文章和许多其他文章中的所有内容之后,还有另一种可能的解决方案,也是唯一对我有用的解决方案......
我正在 Windows 上的 Eclipse Neon 上通过 XDEBUG 调试 PHP 项目。源是远程 Linux,通过 SFTP 在本地安装为驱动器。这可能是我自己的错误,没有正确设置...
在 Eclipse 中,右键单击您的项目,然后选择
配置
,然后选择添加 PHP 支持
。随即,DLTK索引开始;在此之前无论如何都不会启动。然后我必须打开源代码并通过远程文件资源管理器设置断点。我希望这对某人有帮助。
Yet another possible solution, the only one that worked for me, after trying everything in this post and in many others...
I'm debugging a PHP project through XDEBUG on Eclipse Neon on Windows. The source is remote Linux, mounted locally as a drive through SFTP. It's probably my own fault that this isn't set up correctly...
In Eclipse, right-click your project, then select
Configure
, thenAdd PHP Support
. Immediately, the DLTK indexing started; before that it wouldn't start no matter what.Then I had to open my source and set the breakpoints through Remote File Explorer. I hope this helps someone.
我遇到了同样的问题:Eclipse 断点不起作用,xdebug_break() 起作用。我的问题是路径中的空格:
将路径更改为没有空格的路径后,Eclipse 中的断点工作正常。
I had the same problem: Eclipse breakpoints did not work, xdebug_break() did work. My problem were spaces in the path:
After changing the path to something without spaces the breakpoints in Eclipse worked fine.
解决了!
在 NetBeans 中创建新项目时,我首先将项目的根文件夹设置为我的 WordPress 站点的 WordPress 主题文件夹。
因此,我创建了一个新项目,其根是整个 WordPress 网站的根,而不仅仅是其主题,并且断点开始起作用。呜呼!
Solved!
When creating a new project in NetBeans, I first set the root folder of the project to the WordPress theme folder of my WordPress site.
So instead, I created a new project with the root of it being the root of the entire WordPress site rather than just its theme, and the breakpoints started to work. Woohoo!
就我而言:
未在 PHP 可执行文件常规设置中选择
in my case:
was not selected in the PHP Executable general settings