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

Xdebug stops on xdebug_break() but not on breakpoints in NetBeans

我正在尝试结合使用 Xdebug 和 NetBeans 来调试我的 PHP 代码。 在我的代码中设置 xdebug_break() 语句时,它已经按预期工作,即执行在它之后的行停止。

尽管当我在 NetBeans 中为一行设置断点时它不起作用 UI。

我的配置是这样的:

程序:

配置:

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:

那么,为什么 xdebug_break() 有效但断点无效?

原来,造成这种意外行为的原因是运行配置中的项目URL错误。 Project URL 字段实际上需要设置项目的 root URLIndex File字段取索引文件path.

所以,与其这样写:

项目 URL:http://localhost/project_name/some/path/
索引文件:index.php

我不得不这样写:

项目 URL:http://localhost/project_name/
索引文件:some/path/index.php