简体   繁体   English

Xdebug 在 xdebug_break() 处停止,但不在 NetBeans 中的断点处停止

[英]Xdebug stops on xdebug_break() but not on breakpoints in NetBeans

I am trying to use Xdebug in combination with NetBeans to debug my PHP code.我正在尝试将 Xdebug 与 NetBeans 结合使用来调试我的 PHP 代码。 And it is already working as expected when setting a xdebug_break() statement within my code, ie the execution stops at the line after it.在我的代码中设置xdebug_break()语句时,它已经按预期工作,即执行在它之后的行处停止。

Though it does not work when I set a breakpoint for a line within the NetBeans UI.尽管当我为 NetBeans UI 中的一行设置断点时它不起作用。

My configuration looks like this:我的配置是这样的:

Programs:程式:

  • NetBeans 8.1 NetBeans 8.1
  • Xdebug 2.4.1 (Thread Safe, 64-bit) Xdebug 2.4.1(线程安全,64 位)
  • PHP 5.6.26 (Thread Safe, 64-bit) PHP 5.6.26(线程安全,64 位)

Configuration:配置:

php.ini配置文件

zend_extension="C:\Program Files\PHP\ext\php_xdebug-2.4.1-5.6-vc11-x86_64.dll"

[xdebug]
xdebug.remote_enable = On
xdebug.idekey = NetBeans
xdebug.remote_port = 9001
xdebug.var_display_max_children = 1024

NetBeans:网豆:

NetBeans PHP 调试配置

NetBeans 项目运行配置

NetBeans 高级 Web 配置

So, why does xdebug_break() work but not the breakpoints?那么,为什么xdebug_break()有效,但断点无效?

It turned out that the reason for this unexpected behavior was that the project URL in the run configuration was wrong.原来,出现这种意外行为的原因是运行配置中的项目 URL 错误。 The Project URL field actually requires to set the project's root URL and the Index File field takes the index file path . Project URL字段实际上需要设置项目的根 URL ,而Index File字段采用索引文件路径

So, instead of writing this:所以,而不是写这个:

Project URL: http://localhost/project_name/some/path/项目网址: http://localhost/project_name/some/path/
Index File: index.php索引文件: index.php

I had to write this:我不得不这样写:

Project URL: http://localhost/project_name/项目网址: http://localhost/project_name/
Index File: some/path/index.php索引文件: some/path/index.php

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

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