Xdebug 忽略断点

发布于 2024-09-13 07:46:11 字数 1569 浏览 13 评论 0原文

我目前正在尝试让 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 技术交流群。

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

发布评论

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

评论(10

携余温的黄昏 2024-09-20 07:46:11

看起来包含断点的文件的路径有问题。

<- breakpoint_set -i 452 -t line -s enabled 
   -f file:///http:/development.xxx.de/users/itsame/index.php -n 15 ->

我在 Eclipse 中也遇到过类似的问题。仅接受索引文件中的断点,而忽略索引中包含的其他文件中的断点。

我查看了remote_log 文件并看到以下内容:

<- breakpoint_set -i 260 -t line 
   -f file:///~jeroen/workspace/fieg/wp-content/plugins/fieg/fieg.php -n 22-> 
<response xmlns="urn:debugger_protocol_v1" 
   xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" 
   transaction_id="260" id="48060002"></response>

我注意到断点的路径全部错误。结果我必须在 Eclipse 中设置端口映射。设置正确的映射后,断点开始工作。另外,我的 Remote_log 现在显示了正确的路径:

<- breakpoint_set -i 333 -t line 
   -f file:///Users/jeroen/Workspace/fieg/wp-content/plugins/fieg/fieg.php -n 12->     
<response xmlns="urn:debugger_protocol_v1" 
   xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" 
   transaction_id="333" id="48080005"></response>

我不确定 Netbeans 中是否存在与 Eclipse 端口映射配置等效的内容,但希望我为您指明了正确的方向。

It looks like there is something wrong with the path to the file containing the breakpoint.

<- breakpoint_set -i 452 -t line -s enabled 
   -f file:///http:/development.xxx.de/users/itsame/index.php -n 15 ->

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:

<- breakpoint_set -i 260 -t line 
   -f file:///~jeroen/workspace/fieg/wp-content/plugins/fieg/fieg.php -n 22-> 
<response xmlns="urn:debugger_protocol_v1" 
   xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" 
   transaction_id="260" id="48060002"></response>

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:

<- breakpoint_set -i 333 -t line 
   -f file:///Users/jeroen/Workspace/fieg/wp-content/plugins/fieg/fieg.php -n 12->     
<response xmlns="urn:debugger_protocol_v1" 
   xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" 
   transaction_id="333" id="48080005"></response>

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.

旧街凉风 2024-09-20 07:46:11

对我来说,问题是“项目属性 > 源 > 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.

故事还在继续 2024-09-20 07:46:11

在您的 php.ini 文件中,设置此指令:

report_zend_debug = 1

我希望这对某人有帮助?

In your php.ini file, set this directive:

report_zend_debug = 1

I hope this help someone?

美人迟暮 2024-09-20 07:46:11

转到:项目>属性>运行配置>高级(按钮)

如果您不使用 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.

梓梦 2024-09-20 07:46:11

问题提到 xdebug.ini 文件存在,但未报告其内容。
我的默认安装文件仅包括:

zend_extension=/usr/lib/php5/20100525/xdebug.so

但为了真正进行调试,必须启用它。添加此行:

xdebug.remote_enable=1

然后 phpinfo() 将报告正常运行的 xdebug:

在此处输入图像描述

The question mentioned that the xdebug.ini file exists, but does not report its contents.
My default installation's file only included:

zend_extension=/usr/lib/php5/20100525/xdebug.so

But in order for debugging to actually happen, it must be enabled. Add this line:

xdebug.remote_enable=1

Then phpinfo() will report a functioning xdebug:

enter image description here

不离久伴 2024-09-20 07:46:11

我遇到了这篇文章,试图解决 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.

何止钟意 2024-09-20 07:46:11

在尝试了这篇文章和许多其他文章中的所有内容之后,还有另一种可能的解决方案,也是唯一对我有用的解决方案......

我正在 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, then Add 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.

囚你心 2024-09-20 07:46:11

我遇到了同样的问题:Eclipse 断点不起作用,xdebug_break() 起作用。我的问题是路径中的空格:

<- breakpoint_set -i 1323 -t line -f file:///Users/admin/Documents/projects/something/path%2520with%2520space/web/index.php -n 223
-> 
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1323" id="385680235"></response>

将路径更改为没有空格的路径后,Eclipse 中的断点工作正常。

I had the same problem: Eclipse breakpoints did not work, xdebug_break() did work. My problem were spaces in the path:

<- breakpoint_set -i 1323 -t line -f file:///Users/admin/Documents/projects/something/path%2520with%2520space/web/index.php -n 223
-> 
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1323" id="385680235"></response>

After changing the path to something without spaces the breakpoints in Eclipse worked fine.

深者入戏 2024-09-20 07:46:11

解决了!
在 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!

征棹 2024-09-20 07:46:11

就我而言:

use system default php.ini configuration 

未在 PHP 可执行文件常规设置中选择

in my case:

use system default php.ini configuration 

was not selected in the PHP Executable general settings

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