【问题标题】:Netbeans waiting for connection to XDEBUGNetbeans 等待连接到 XDEBUG
【发布时间】:2013-12-15 03:32:12
【问题描述】:

Netbeans 不会连接到 xdebug。我尝试了以下帖子的建议:

Debugging IDE's port connection to XDebug: "Waiting to Connect"

netbeans shows "Waiting For Connection (netbeans-xdebug)"

但这并不能解决我的问题。

Netbeans 似乎连接到 xdebug,因为在它等待连接时,向网络服务器 [Apache2] 发出的所有请求都被阻止了。端口 [9001] 似乎也在使用中:

roxy@Pixy011 ~ $ sudo nmap -sS -O 127.0.0.1

Starting Nmap 6.00 ( http://nmap.org ) at 2013-11-28 20:48 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000029s latency).
Not shown: 990 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
631/tcp  open  ipp
902/tcp  open  iss-realsecure
3306/tcp open  mysql
8080/tcp open  http-proxy
8081/tcp open  blackice-icecap
9001/tcp open  tor-orport   <---- Opened by java

xdebug.ini: [我已经确认它是在 phpinfo() 中加载的]

zend_extension=/usr/lib/php5/20100525/xdebug.so

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9001
xdebug.idekey="netbeans-xdebug"

Netbeans 配置:

Debugger port: 9001
Session ID: netbeans-xdebug
Stop at first line: Checked
All other options are unchecked

项目属性:

Host: 127.0.0.1
Port: 9001

编辑: 我注意到 Netbeans 不会将 XDEBUG_SESSION_STOP 附加到 URL。我认为这与问题无关,因为 Netbeans 仅在我关闭调试会话后才打开页面。

我也禁用了 SELinux

【问题讨论】:

标签: php netbeans xdebug


【解决方案1】:

在 Ubuntu 13.04 64bit php 5.4.9-4 Xdebug v2.2.3 netbeans 7.4 上
我有同样的问题并通过以下方式解决:
1.继续http://xdebug.org/wizard.php按照说明编译你自己的xdebug.so
2.在netbean 7.4的一般选项中(对不起我没有声誉10来张贴图片) 测试连接。确保代理上的设置正确: 对我来说,“无代理”正在工作。
3. 在 php options 调试选项卡中将 xdebug 设置端口更改为 9001 或 9000 以外的端口。 我选择 9002 但你可以尝试直到找到一个空闲端口(如果端口不是空闲的 nb 告诉你)
4. 在 php.ini OR for ubuntu users 在 /etc/php5/conf.d/20-xdebug.ini

zend_extension=/usr/lib/php5/20100525/xdebug.so #你把重新编译的 xdebug.so 放在哪里
[xdebug]
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_port=9002 # 您在上面的 netbeans 中找到并设置的免费端口
xdebug.remote_host=127.0.0.1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/tmp/"
xdebug.idekey="netbeans-xdebug"
xdebug.remote_log="/home/#user_name#/xdebug.log" #你的用户名

5。 sudo service apache2 重启

完成此操作后,我可以再次调试 php。

【讨论】:

  • 谢谢莱昂纳多。我跳过了 1 (想知道我是否可以避免这种情况)并且它起作用了。返回并一一测试每个更改,似乎只有端口阻止了连接。
  • 我已经尝试使用 xdebug 2.2.1 进行工作,因此您可以通过 apt-get install php5-xdebug 查看它,但步骤 1 非常简单,因此您可以使用最后一个 xdebug。跨度>
  • 我以前在我的电脑上安装了 nb 7.4,安装后我发现代理默认系统上的先前设置对 xdebug 不再有好处:我必须不安装代理!端口号的更改是强制性的。我做了同样的测试来确定端口 9001 是否空闲,但它们失败了。所以我认为最好尝试一个端口直到成功:-)
  • 对于以后来的人,我在 WAMP 上并使用他们的默认 PHP.ini,我需要让 NetBeans 正常工作的唯一更改是:xdebug.remote_enable = on
  • xdebug.remote_enable=on xdebug.remote_host=localhost
【解决方案2】:

我遇到了同样的问题,我尝试了很多我在那里找到的解决方案,但问题仍然存在。我已尝试按照enter link description here

中描述的步骤进行操作

enter link description here

而且,whttp://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebughen 我调试我的项目,我的 netbeats 仍在等待连接,直到我必须有以下“? XDEBUG_SESSION_START=netbeans-xdebug" 在我的网址中为 http://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebug 所以 netbeans 能够与 xdebug 连接

【讨论】:

    【解决方案3】:

    **在带有 Netbeans 8.0 的 Windows 10 上运行内置网络服务器的 Netbeans **

    php.ini 文件中的以下选项为我解决了这个问题:

    zend_extension ='C:\php 安装路径\ext\php_xdebug-2.5.0-5.6-vc11.dll' xdebug.remote_enable=on

    对我来说,这个问题似乎可以通过使用 .dll 文件的完整路径来解决。另外,因为路径名中有空格,所以我必须将路径括在引号中(双引号与单引号似乎无关紧要)。另外,我必须设置 xdebug.remote_enable 选项。一旦我设置了这两个选项,我就可以在 Netbeans 中选择 Debug Application 选项并启动调试器。

    【讨论】:

    • 由于这是一个很受欢迎的问题,我认为您可以查看how to write a good answer。请添加一些参考资料并扩大您的解释范围。
    【解决方案4】:

    我遇到了类似的问题,在我的情况下,我最近更新了我的 php 版本,并且 xdebug 配置位于唯一的 php5 文件夹中。只需将旧的 xdebug 配置复制到新版本的新 php.ini 文件中,它就可以像以前一样工作。

    一些调试技巧是:

    1. 首先检查是否安装了 xdebug,如果没有 xdebug 详细信息,则运行 (php -v) 然后安装并添加配置。
    2. 打开 xdebug 类别下的 phpinfo() 检查是否加载了 xdebug 配置。检查以下设置。
      • remote_enable = on,remote_handler=dbgp

    【讨论】:

      【解决方案5】:

      在使用 Netbeans 在 vi​​rtualbox ubuntu 机器上运行 xdebug 时,我遇到了同样的问题。

      PHP 7.4 版

      更改了以下文件

      "/etc/php/7.4/apache2/conf.d/20-xdebug.ini"
      

      并添加了以下几行

      zend_extension="/usr/lib/php/20190902/xdebug.so"
      xdebug.remote_enable=1
      xdebug.remote_handler=dbgp
      xdebug.remote_mode=req
      xdebug.remote_host=127.0.0.1
      xdebug.remote_port=9000
      xdebug.remote_log = "/var/log/xdebug.log"
      

      请注意,下面的行包含用于定义路径的双引号。

      zend_extension="/usr/lib/php/20190902/xdebug.so"
      

      【讨论】:

        【解决方案6】:

        有同样的问题:

        $ netstat | grep 9000
        ...
        tcp6       1      0 localhost:9000          localhost:37486         CLOSE_WAIT
        

        解决方案:重新启动 NetBeans。 正在运行一个等待连接的死进程。

        这里是带有正在运行的调试会话的 Netbeans。请注意 CLOSE_WAITTIME_WAIT

        tcp6       0      0 localhost:9000          localhost:38166         TIME_WAIT 
        

        【讨论】:

        • 我也有同样的问题。运行几次后总是以死连接告终。唯一的解决办法是重启nb。寻找其他解决方案。如果你发现任何请告诉。
        【解决方案7】:

        对于 Xdebug v>=3

        如果您在尝试上述所有答案后仍然遇到问题。并且您的 Xdebug 版本 >=3 然后只尝试我的步骤。

        在 v3 中更改了一些设置。

        1. Xdebug 的默认调试端口已从9000 更改为9003。所以在 php.ini 和 netbeans IDE 中更改它。
        2. 在 php.ini 中
        • 添加xdebug.start_with_request="yes"

        • 添加 xdebug.client_host = localhost 。 (旧的xdebug.remote_host=localhost 在 v3 中不再有用)

        • 添加xdebug.mode=debug

        【讨论】:

          猜你喜欢
          • 2015-11-16
          • 2013-07-10
          • 2016-03-13
          • 2018-08-09
          • 2023-03-03
          • 1970-01-01
          • 2011-10-12
          • 2015-07-14
          相关资源
          最近更新 更多