使用 XDebug 和 XAMPP 从 NetBeans 调试 PHP

Debugging PHP, from NetBeans using XDebug and XAMPP

我已关注this document:

这是我的php.ini

[XDebug]
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000

我是 运行 Apache,在端口 9000 上使用 XAMPP:

当我从 NetBeans 执行时:调试 -> 调试项目

我得到以下信息:

Port 9,000 is already in occupied. Configure the IDE to use another port?

XAMPP是正在使用900万端口的软件。我需要在这里做什么?我应该将 XDebug 端口更改为 9001 吗?工具 -> 选项:

如果这样做,我还需要更改 php.ini 并将 XDebug 端口更改为 9001。

还是我应该继续使用端口 9000?我有不同的设置,但无法达到我的断点。

多年来我一直在使用 Netbeans 编写代码 PHP,而 xdebug 一直是个难题。我什至不能给你任何指示。

但我去年切换到 VS 代码,老实说它改进了我的代码,而且 xdebug 实际上很容易连接,使用起来很有趣。

我建议你试一试。

这就是我得到调试器的方式运行:

  1. 出现提示时:

Port 9,000 is already occupied Configure the IDE to use another port?

单击是(或者您可以从 工具 -> 选项 打开设置:选择 PHP -> 调试

将调试器端口设置为 9001。

  1. 更新 php.ini 以拥有端口 9001
[XDebug]
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_port = 9001
  1. 重启XAMPP