无法使用PhpStorm + Vagrant + XDebug进行调试

Nad*_* S. 21 xdebug phpstorm vagrant

我不能让XDebug在Windows 7机器上与PhpStorm和Vagrant合作.我已经按照每个教程来完成这项工作,但没有运气.

所以我试过的是:

  • PhpStorm始终监听调试连接
  • xdebug.ini文件包含以下内容:

zend_extension = "..../xdebug.so"
xdebug.remote_enable= 1
xdebug.remote_handler=dbgp
xdebug.remote_host= 33.33.33.10
xdebug.remote_port= 9000
xdebug.remote_connect_back= 1
xdebug.remote_autostart= 1
xdebug.remote_log = "...."
Run Code Online (Sandbox Code Playgroud)
  • 设置PhpStorm来连接localhost:8080太33.33.33.10,既没有运气.
  • 日志文件始终输出:

I: Checking remote connect back address.
W: Remote address not found, connecting to configured address/port: 33.33.33.10:9000. :-|
E: Could not connect to client. :-(
Run Code Online (Sandbox Code Playgroud)
  • 我尝试调试时,防火墙(ESET Smart Security)始终处于关闭状态
  • 设置路径映射,也没有工作

我只是不知道该怎么做,但我真的需要能够调试.
谢谢你的帮助!

Nad*_* S. 41

问题非常愚蠢 - 我在Vagrantfile中转发了端口9000,而我没有这样做......

现在,实际上我看到xdebug.ini中唯一必要的行是:

zend_extension = ...
xdebug.remote_enable = on
xdebug.remote_connect_back = on
Run Code Online (Sandbox Code Playgroud)

如果你不做愚蠢的事情,设置非常简单......

  • 对于那些想知道为什么当他停止转发9000端口时它开始为Nadav工作的人,这是因为Xdebug实际上是相反的.而不是您的计算机连接到端口9000上的Vagrant盒子,Xdebug实际上是反向工作 - 您的Vagrant盒子将连接到您(主机)计算机上的Xdebug客户端.James Walker对[这里](http://walkah.net/blog/debugging-php-with-vagrant/)有一个很好的解释. (15认同)
  • 甚至不需要remote_handler - 默认设置dbgp. (2认同)
  • `debug.remote_connect_back = on` 正是我所需要的:Mac OS X 主机,在 Ubuntu 14.04 上运行 vagrant。 (2认同)