2013-03-11 51 views
20

我無法讓XDebug與Windows 7機器上的PhpStorm和Vagrant配合使用。我已經遵循每個教程來讓這個工作,但沒有運氣。無法使用PhpStorm + Vagrant + XDebug進行調試

所以我已經試過是:

  • 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 = "...." 
  • 設置PhpStorm連接到localhost:808033.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. :-(
  • 防火牆(ESET Smart Security的)總是被關斷時,我嘗試調試
  • 設置路徑映射,沒」 t工作要麼

我只是不知道該怎麼做,但我真的需要能夠進行調試。
感謝您的幫助!

+2

什麼機器33.33.33.10屬於 - 你真正的一個(PhpStorm tuns)還是虛擬(Vagrant)?它必須是具有PhpStorm的機器的IP(從虛擬機看) - 檢查$ _SERVER ['REMOTE_ADDR']具有什麼。好文章閱讀:http://confluence.jetbrains。com/display/PhpStorm /零配置+ Web +應用程序+調試+ + Xdebug +和+ PhpStorm – LazyOne 2013-03-11 13:17:26

+0

33.33.33.10屬於Vagrant,但在Windows上大家都說它必須是VM而不是PhpStorm的機器 – 2013-03-15 09:02:27

+0

It必須是運行調試客戶端(我們的情況下爲PhpStorm)的計算機的IP地址 - 請查看xdebug手冊中關於xdebug.remote_host的說明。 **除非你正在使用SSH tuneling和/或xdebug代理(這有點奇怪(主要是代理),因爲它位於同一臺計算機上,而不是在防火牆和路由器之後的互聯網上) - 在這種情況下,聽什麼「每個人說「並問他們如何設置 - 我沒有與此合作。 – LazyOne 2013-03-15 09:52:12

回答

38

問題非常愚蠢 - 我在Vagrantfile中轉發了端口9000,噸有這樣做......

現在,其實我看到,在xdebug.ini唯一需要的線路有:

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

的設置是非常簡單的,如果你不這樣做愚蠢的事情。 ..

+13

對於那些想知道爲什麼當他停止轉發9000端口時爲Nadav工作的原因,這是因爲Xdebug實際上是反其道而行之。相反,您的計算機連接到端口9000上的Vagrant框,Xdebug實際上是反向工作 - 您的Vagrant框將連接到您的(主機)計算機上的Xdebug客戶端。詹姆斯沃克對[這裏]有很好的解釋(http://walkah.net/blog/debugging-php-with-vagrant/)。 – Jonathan 2013-05-23 16:19:45

+2

即使不需要remote_handler - dbgp默認設置。 – Yurik 2013-09-28 00:31:16

+1

'debug.remote_connect_back = on'正是我所需要的:Mac OS X主機,在Ubuntu 14.04上運行vagrant。 – Jimbo 2015-09-05 13:43:56

0

確保您從PHPStorm內部連接到正確的URL。我的流浪盒子的IP地址爲192.168.50.2,所以我必須設置我的項目地址=> 192.168.50.2

+0

感謝30equals,我已經設法解決了這個問題。唯一的問題是,我已經轉發了Vagrantfile中的端口9000,我不必......關於你的答案 - 我已經嘗試過了,不過謝謝你! – 2013-03-30 22:24:53

0

我必須設置

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

所以我的整個配置是這樣的:

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' 

主持人:Linux的

VM:流浪漢與PuPHPet使用VirtualBox

沒什麼特別PhpStorm

配置發現它在這裏:http://jeromejaglale.com/doc/php/xdebug_vagrant_puphpet_phpstorm