简体   繁体   English

Xdebug忽略NetBeans中的断点

[英]Xdebug ignores breakpoints in NetBeans

I am trying to debug a local Wordpress instance (on xampp) in NetBeans, on Windows 7. For some reason the breakpoints outside of any file living in the webserver's root are ignored. 我正在尝试在Windows 7的NetBeans中调试本地Wordpress实例(在xampp上)。出于某些原因,将忽略位于Web服务器根目录中的任何文件之外的断点。

I have Googled around for ages, to no avail. 我已经搜索Google很久了,但无济于事。 I have read SO1 , SO2 , SO3 , SO4 , SO5 and SO6 , also to no avail. 我已经阅读了SO1SO2SO3SO4SO5SO6 ,也无济于事。 All these SOs mention Path Mapping. 所有这些SO都提到了路径映射。 I have mapped all my folders, but since my project folder is the same as my project folder, these mappings are exactly the same. 我已经映射了所有文件夹,但是由于我的项目文件夹与我的项目文件夹相同,因此这些映射完全相同。 Moreover, the path in the xdebug log points to the correct file (see below). 此外,xdebug日志中的路径指向正确的文件(请参见下文)。

Calling xdebug_break(); 调用xdebug_break(); only works when it is called in one of the files living in the webserver's root (`wp-develop' in my case), so I suspect I'm not mapping the paths correctly. 仅当在网络服务器根目录中的一个文件中调用它时才起作用(在我的情况下为“ wp-develop”),因此我怀疑我没有正确映射路径。

The portion of my php.ini file that is related to xdebug looks like this: 我的php.ini文件中与xdebug相关的部分看起来像这样:

[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = On
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port=9000
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1
xdebug.remote_log = "C:\xdebugremotelog.txt"  

The output of the xdebug log looks like this: xdebug日志的输出如下所示:

<- breakpoint_set -i 122 -t line -s enabled -f file:///c:/xampp/htdocs/wp-develop/wp-content/themes/gap/gap.php -n 32
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="122" state="enabled" id="81240001"></response>

c:/xampp/htdocs/wp-develop/wp-content/themes/gap/gap.php is the correct path. c:/xampp/htdocs/wp-develop/wp-content/themes/gap/gap.php是正确的路径。

What am I missing here? 我在这里想念什么? Any help would be appreciated. 任何帮助,将不胜感激。

In fact, I think I might be doing the Path Mappings wrong. 实际上,我认为路径映射可能做错了。 Could someone give me an example of how they should actually look? 有人可以给我一个例子,说明他们的实际外观吗?

I have had a similar problem on a Windows system: Eclipse breakpoints work fine for any php command-line project and don't for any web application. 我在Windows系统上也遇到过类似的问题:Eclipse断点对任何php命令行项目都适用,而对任何Web应用程序均不起作用。 I have spent two hours to solve the problem. 我已经花了两个小时来解决问题。

Please check if your web server is listening on the 127.0.0.1 address and not on "localhost". 请检查您的Web服务器是否在127.0.0.1地址上侦听,而不是在“ localhost”上侦听。 Why ? 为什么呢 Because from Vista up, Windows uses ipv4 to connect to 127.0.0.1 while it uses ipv6 to connect lo the "localhost" address. 因为从Vista开始,Windows使用ipv4连接到127.0.0.1,而Windows使用ipv6连接“本地主机”地址。

So, the solution is to use ipv4 on all the debug stack: 因此,解决方案是在所有调试堆栈上使用ipv4:

Launch the php built-in webserver (any or other) to listen on 127.0.0.1 启动php内置的web服务器(任何或其他)以侦听127.0.0.1

I hope that this will help you 希望对您有帮助

Regards from Italy 来自意大利的问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM