【问题标题】:Netbeans Xdebug Vagrant connection timeoutNetbeans Xdebug Vagrant 连接超时
【发布时间】:2014-08-23 18:18:28
【问题描述】:

我正在尝试让 xdebug 为 PHP 工作,Netbeans 连接到配置了 Vagrant 的 VM(如果重要,请使用 PuPHPet 进行设置)

我的虚拟机上有这些 php.ini 设置:

[XDEBUG]
xdebug.remote_connect_back=1
xdebug.default_enable=1
xdebug.remote_autostart=0
xdebug.max_nesting_level=256
xdebug.remote_enable=1
xdebug.remote_log=/tmp/php5-xdebug.log
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=netbeans-xdebug

Netbeans 的路径映射正确并设置为作为本地网站运行。它使用 GET 变量正确启动浏览器以开始调试。我的 Windows 防火墙允许 netbeans,我添加了一条规则以允许从我的 VM IP 到我的本地 IP 的所有内容(都是 192.168.56.x 地址,因此它是正确的子网)。

从我的虚拟机我可以很好地 ping 我的主机操作系统。但在 xdebug 日志中,我只看到:

Log opened at 2014-08-23 17:43:28
I: Checking remote connect back address.
I: Remote address found, connecting to 192.168.56.1:9000.
E: Time-out connecting to client. :-(
Log closed at 2014-08-23 17:43:28

在我的主机操作系统上,我尝试了 netstat 并验证 Netbeans 正在侦听端口 9000。 我在 Virtualbox 中删除了 9000 上的端口转发,因为我已经读到我不需要它(最初我有它,但 Netbeans 抱怨说在 9000 上有其他东西正在监听)。

我意识到 php-fpm 也使用端口 9000,所以我尝试了 9001(在 ini 中重新启动了 php-fpm,并且在 IDE 中,也验证了 IDE 现在正在侦听 9001)。结果相同:

I: Checking remote connect back address.
I: Remote address found, connecting to 192.168.56.1:9001.
E: Time-out connecting to client. :-(
Log closed at 2014-08-23 18:11:59

所以现在我已经阅读了所有内容,但我被困在这里。有什么想法吗?

【问题讨论】:

    标签: php netbeans vagrant xdebug


    【解决方案1】:

    在我发帖的时候,我找到了答案:

    $ netstat -r
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    10.0.2.0        *               255.255.255.0   U         0 0          0 eth0
    192.168.56.0    *               255.255.255.0   U         0 0          0 eth1
    link-local      *               255.255.0.0     U         0 0          0 eth0
    link-local      *               255.255.0.0     U         0 0          0 eth1
    default         10.0.2.2        0.0.0.0         UG        0 0          0 eth0
    

    注意最后一行。所以我改变了:

    xdebug.remote_connect_back=1
    

    xdebug.remote_host=10.0.2.2
    

    它在 php-fpm 重启后立即工作!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-07
      • 2015-11-16
      • 1970-01-01
      • 2014-09-09
      • 2018-04-10
      • 2013-07-10
      • 2013-12-15
      相关资源
      最近更新 更多