Cannot debug with PhpStorm + Vagrant + XDebug

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 05:46:12

问题


I cannot get XDebug to work with PhpStorm and Vagrant on a Windows 7 machine. I've already followed every tutorial on getting this to work but with no luck.

So what I've tried is:

  • PhpStorm always listens to debug connections
  • xdebug.ini file with the following:

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 = "...."
  • Setup PhpStorm to connect to localhost:8080 and too 33.33.33.10, both with no luck.
  • The log file always outputs:

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. :-(
  • The firewall (ESET Smart Security) is always turned-off when I try to debug
  • Set path mappings, didn't work either

I just don't know what to do, but I really NEED to be able to debug.
Thanks for your help!


回答1:


The problem was very stupid - I forwarded port 9000 in the Vagrantfile, and I didn't have to do so...

Now, actually I see that the only necessary lines in xdebug.ini are:

zend_extension = ...
xdebug.remote_enable = on
xdebug.remote_connect_back = on

The setup is pretty straightforward, if you don't do stupid things...




回答2:


Make sure you connect to the right url from within PHPStorm. My vagrant box has the ip of 192.168.50.2 for instance, so i have to set the url of my project => 192.168.50.2




回答3:


I had to set

xdebug.remote_connect_back = '0'
xdebug.remote_host= '10.0.2.2'

so my whole config looks like this:

xdebug.default_enable: '1'
xdebug.remote_autostart: '1'
xdebug.remote_connect_back: '0'
xdebug.remote_enable: '1'
xdebug.remote_handler: dbgp
xdebug.remote_host: '10.0.2.2'
xdebug.max_nesting_level: '400'

Host: Linux

VM: Vagrant with PuPHPet using VirtualBox

nothing special to configure in PhpStorm

found it here: http://jeromejaglale.com/doc/php/xdebug_vagrant_puphpet_phpstorm



来源:https://stackoverflow.com/questions/15339165/cannot-debug-with-phpstorm-vagrant-xdebug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!