php - Netbeans Xdebug Vagrant 连接超时

标签 php netbeans vagrant xdebug

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

我的 VM 上有这些 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 地址,所以它是正确的子网)。

我可以从我的 VM 正常 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

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

最佳答案

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

$ 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 重启后立即生效!

关于php - Netbeans Xdebug Vagrant 连接超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25464986/

相关文章:

linux - Netbeans——源不可写

c++ - 使用netbeans编译C++

mysql - Vagrant、Ansible 和 MySql : ERROR! 在任务中未检测到任何操作。这通常表示模块名称拼写错误或模块路径不正确

ubuntu - 在 ubuntu 中安装 vagrant 吗?

使用 Vagrant 进行 HAML/SASS 开发时的图像显示/截断问题

php - 如何显示mysql每个类别的最新条目

php - 如何在无脂框架中的 SQL-Mapper 中传递日期函数?

php - Apache2 进程永远不会结束 - 我如何确定原因?

php - symfony 2 中的结构应用

Java,JoptionPane : the yes-no dialog keeps on showing