Netbeans中的Xdebug:不会在“ Web根目录”父文件夹中的文件内的断点处停止

问题描述 投票:2回答:5

我有一个带有这样的目录树的netbeans项目:

<source folder>
|
|---> gui <web root folder>
|      |
|      L---> datos.php
|
L---> index.php

datos.php将工作目录更改为..(源文件夹),并包含index.php,如下所示:

chdir('..');
require 'index.php';

如果我在datos.php中放置一个断点,调试器将在其上正确断开,但是在index.php中放置一个断点时,它将忽略它。

奇怪的是,六个月前我遇到了同样的问题,并且能够解决它。现在我不知道为什么它停止工作,然后我又做了什么来解决它。

更多信息:

xdebug日志显示以下用于断点设置的命令:

breakpoint_set -i 315 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php -n 51
breakpoint_set -i 316 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/gui/datos.php -n 39 

在两种情况下,xdebug都以state =“ enabled”响应

并且如果我手动调试,则可以使用以下命令设置断点,有效

breakpoint_set -i 315 -t line -s enabled -f file:///../index.php -n 51

但是我不知道如何让Netbeans使用相同的[[file:///../index.php参数而不是file:/// Users / tomasgirardi / NetBeansProjects]发出breakpoint_set命令/datamed/index.php或其他任何可以使这项工作有效的方法。

提前感谢您的帮助!
netbeans xdebug
5个回答
9
投票
您总是可以尝试使用xdebug_break();

例如:

<?php for ( $i=1, $j=0; $i<10; $i++) { xdebug_break(); echo "<br>Line $i"; // will stop here } ?>

将在下一行添加一个断点。

希望有所帮助...


2
投票
断点再次起作用。我没有任何线索说明为什么他们以前没有工作过,但是现在他们这样做了。我也不记得在xdebug或Netbeans中进行任何更改。

xdebug.log向我显示了与以前相同的内容,但是现在它在设置的断点处停止:

<- breakpoint_set -i 4 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php -n 51 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="4" state="enabled" id="14290001"></response> <- run -i 5 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php" lineno="51"></xdebug:message></response>

但是,如果有人知道为什么会发生这种情况,分享它可能会有所帮助:将来我或其他人也许可以避免遇到类似的麻烦。

2
投票
此问题更特定于将远程服务器用于其Web应用程序的人员。

我有同样的问题。 Xdebug ignores breakpoints确实为我提供了帮助,但是我提供了针对Netbeans的解决方案,但本质是相同的,无论您使用的是哪种IDE。只需将本地项目路径与远程服务器路径映射即可。

我的环境是WINDOWS 7,网站托管在UBUNTU VM上。我正在使用Windows 7中的NETBEANS,并已设置了一个远程项目。

我的xdebug日志

<- breakpoint_set -i 4 -t line -s enabled -f file:///C:/Users/ali/Documents/NetBeansProjects/test.com.au/cgen/src/Acme/TestBundle/Controller/CreateController.php -n 39

->

真正的问题是netbeans

[C:/Users/ali/Documents/NetBeansProjects/test.com.au]中的项目路径和Web服务器上的项目路径。 / home / ali / sites / test.com.au

修复:

在Netbeans中,单击您的项目>属性>运行配置>高级>只需放置适当的服务器路径和等效的项目路径。它将正常工作。

0
投票
通过注释xdebug.extended_info = 0解决了同一问题。也可以将其切换为1。

0
投票
为了使其再次工作,我在php.ini中将xdebug.remote_host=127.0.0.1更改为xdebug.remote_host=localhost

下面是我的xdebuga配置

xdebug.remote_enable=1 xdebug.remote_port=9001 xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_autostart = 1 xdebug.show_local_vars = 1 xdebug.profiler_enable = 1 output_buffering=off xdebug.idekey=netbeans-xdebug

© www.soinside.com 2019 - 2024. All rights reserved.