18

我正在尝试在本地使用 NetBeans Mac 进行调试。

这是我的 php.ini

[xdebug]
 xdebug.default_enable=1
 xdebug.remote_enable=1
 xdebug.remote_handler=dbgp
 xdebug.remote_host=localhost
 xdebug.remote_port=9000
 xdebug.remote_autostart=1
 xdebug.remote_log="/Applications/MAMP/logs/xdebug.log"
 xdebug.idekey="netbeans-xdebug"
 zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"

这就是我在 xdebug.log 中得到的

  I: Connecting to configured address/port: localhost:9000.
   E: Could not connect to client. :-(

我尝试将端口更改为 9001 并关闭防火墙,但没有帮助。

4

3 回答 3

12

Xdebug 的默认端口 (9000) 与 FastCGI 冲突(Xdebug 是第一个!) - 解决方案是将其更改为另一个端口。完成此操作后,您需要重新启动 IDE,您还需要在其中配置新端口。您还需要重新启动 PHP 和您的 Web 服务器。

于 2013-06-23T09:36:02.477 回答
8

第 1 步:更改xdebug.remote_port=9000xdebug.remote_port=9001

第2步:

  1. 更改 Netbeans 中的调试端口。转到工具>>选项>>单击PHP选项卡
  2. 在 PHP 选项卡下单击调试
  3. 更改调试器端口:9001
  4. 更改会话 ID:netbeans-xdebug

第 3 步:重新启动服务器和 netbeans

第 4 步:设置断点并尝试

于 2013-07-01T06:00:55.443 回答
6

我有完全相同的问题。xdebug 安装向导 ( https://xdebug.org/wizard.php ) 显示我的 xdebug 已正确安装。(向导告诉我安装 Xdebug 2.5.0rc1 dll)在 phpinfo 中,我还得到了一个 xdebug 部分,显示(在我看来)正确的值。即使这样,我在错误日志中也收到“无法连接到客户端”消息。

最终,我通过反复试验解决了这个问题:为我的 php 版本下载了所有旧版本的 xdebug dll 并尝试了所有这些。最终,其中一个起作用了。对我来说,它是在 windows 7 32 位机器上使用 php 5.6.8 xdebug 2.4.1 dll (PHP 5.6 VC11 TS (32 bit) )。我正在使用 xampp-win32-5.6.8-0-VC11.zip 进行 xampp 安装。

我学到的是以下内容: (a) Xdebug 向导不一定提供正确的 dll 以供使用 (b) 即使 phpinfo 显示带有正确变量的 Xdebug 部分,这并不一定意味着它是正确的。(c) 如果遇到此错误,请尝试使用旧版本的 dll。

于 2016-11-14T11:58:34.790 回答