Netbeans中的Xdebug:在";web根目录';s";父文件夹

Netbeans中的Xdebug:在";web根目录';s";父文件夹,netbeans,xdebug,Netbeans,Xdebug,我有一个netbeans项目,其目录树如下: <source folder> | |---> gui <web root folder> | | | L---> datos.php | L---> index.php chdir('..'); require 'index.php'; 如果我在datos.php中放置断点,调试器会正确地打断它,但在index.php中放置断点时会忽略它。 奇怪的是,6个月前我也遇到了同样的问题,我

我有一个netbeans项目,其目录树如下:

<source folder>
|
|---> gui <web root folder>
|      |
|      L---> datos.php
|
L---> index.php
chdir('..');
require 'index.php';
如果我在datos.php中放置断点,调试器会正确地打断它,但在index.php中放置断点时会忽略它。

奇怪的是,6个月前我也遇到了同样的问题,我能够解决它。现在我不知道为什么它停止工作,我当时做了什么来修复它

更多信息:

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/datamed/index.php或者我可以采用的任何其他方法


提前感谢您的帮助

断点再次工作。我不知道他们为什么以前不工作,但现在他们工作了。我也不记得在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>


但是,如果有人知道为什么会发生这种情况,那么无论哪种方式,分享都会很有帮助:也许我或其他人将来可以避免类似的问题。

您可以尝试使用xdebug_break()

例如:

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

将在下一行中添加断点


希望这有点帮助…

通过评论xdebug.extended_info=0解决了同样的问题。也可以将其切换为1。

此问题对于使用远程服务器进行web应用的用户更为特殊

我也有同样的问题。确实帮助了我,但是我给出了针对netbeans的更具体的解决方案,但本质是一样的,无论您使用哪种IDE。只需将本地项目路径映射到远程服务器路径

我的环境是Windows7,网站托管在UBUNTU虚拟机上。我正在使用Windows7中的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中单击您的项目>属性>运行配置>高级>只需放置适当的服务器路径和等效的项目路径。它会很好用的

为了让它再次工作,我在php.ini中将
xdebug.remote\u host=127.0.0.1
更改为
xdebug.remote\u 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

你在用符号链接吗?@Derick,我没有用符号链接。但是今天我又试了一次,断点开始工作了?!我想知道为什么7天前它不起作用,但现在它起作用了。xebug.log的显示与之前相同,只是这次它在每个断点处停止:记不起在xdebug或nbug中进行了更改。谢谢!好提示!下次遇到这样的困难我会试试的。我再也没有经历过同样的问题,也没有发现那一次发生的原因。我希望它不会再次发生,但如果它发生,至少我有一个新的提示可以尝试。太好了!!很高兴你喜欢!祝你好运!:)我看到了同样的行为——不工作,然后只是工作。说起来很难过,但对于有这个问题的人,我建议他们放弃Netbeans和MAMP,重新启动它们。尤其是在您更改了项目设置之后。只是好奇-您的项目是否已配置为复制到另一个目录?底部的修复程序工作正常,谢谢:)