問題描述
有一段時間,我使用 Phpstorm EAP,并且 xdebug 運行良好.我最近購買了個人許可證并將我的所有設置從 EAP 導入到 7.1.3.現在 xdebug 不起作用了.
For a while, I was using Phpstorm EAP, and had xdebug running perfectly. I recently purchased a personal license and imported all my settings from the EAP into 7.1.3. Now xdebug does not work.
這里是 xdebug.ini
Here's xdebug.ini
zend_extension=xdebug.so
xdebug.remote_host = 192.168.56.1
xdebug.remote_cookie_expire_time = 36000
xdebug.remote_log = /tmp/xdebug.log
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.idekey="PHPSTORM"
xdebug.scream=0
xdebug.remote_connect_back=1
xdebug.show_local_vars=1
xdebug 也顯示在 php.ini 中.我什至在 http://xdebug.org/wizard.php 中運行它并安裝了最新版本.
xdebug is also showing in the php.ini. I even ran it in http://xdebug.org/wizard.php and the latest version is installed.
Phpstorm 正在端口 9000 上偵聽 xdebug,并且偵聽 PHP 調試連接"已開啟.
Phpstorm is listening on port 9000 for xdebug, and "Listen for PHP Debug Connections" is on.
我的 xdebug 日志不斷告訴我:
My xdebug log constantly tells me this:
Log opened at 2014-07-18 17:46:16
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-07-18 17:46:16
我什至嘗試過注冊表http://brianreiter.org/2010/09/18/fix-virtualbox-host-only-network-adapter-create-a-virtual-public-network-connection-that-c??auses-windows-to-disable-services/
無論我嘗試什么,xdebug 都會超時.即使關閉了所有防火墻.
No matter what I try, xdebug times out. Even with all firewalls off.
我使用的是 Windows 7 Enterprise.虛擬機是 puphpet/centos65-x64
I'm on Windows 7 Enterprise. VM is puphpet/centos65-x64
編輯忘了說Phpstorm中IDE的key是PHPSTORM
EDIT Forgot to mention the IDE key in Phpstorm is PHPSTORM
推薦答案
為了直接回答您的困惑,有兩個設置很突出.它們是 xdebug.remote_host
和 xdebug.remote_connect_back
.前一個設置的 IP 不正確,尤其是在 Vagrant 設置中.它應該類似于 10.0.2.2
.此外,不應定義和啟用后一種設置.啟用后,它會完全忽略之前的設置,從而使其變得無用.總結一下,前一個設置是錯誤的,后一個設置忽略它,但是后一個設置也是錯誤的.不過,這些設置只是 Xdebug 無法工作的部分原因.
To answer your confusion directly, two settings stand out. They are xdebug.remote_host
and xdebug.remote_connect_back
. The former setting's IP is incorrect, especially in a Vagrant setup. It should be something like 10.0.2.2
. Furthermore, the latter setting should not be defined and enabled. When it is enabled, it completely ignores the former setting, thus rendering it useless. To summarize, the former setting is wrong, and the latter setting ignores it, but that latter setting is also wrong. These settings are only part of the reason Xdebug will not work, though.
Vagrant 引入了一層在標準的非虛擬化開發(fā)環(huán)境中不存在的復雜性.雖然以上幾點可能是正確的,但為了通過 Vagrant 在 PhpStorm 中運行 Xdebug,仍然需要遵循額外的設置和過程.我為此苦苦掙扎了一段時間,在多次嘗試失敗后,成功建立了連接.實現這種設置的在線文檔也有很大的不足,所以在成功使整個設置工作后,我在我的博客上記錄了指導方針.詳細描述了整個設置過程,并附有相關屏幕截圖.我也使用 CentOS 6.5 64 位,指南反映了這一點.它甚至已經針對 Magento 進行了測試.
Vagrant introduces a layer of complexity not present in a standard, non-virtualized development environment. While the points above are probably correct, there are still additional settings and procedures that need to be followed in order to run Xdebug in PhpStorm through Vagrant. I struggled with this for a while, and after several failed attempts, succeeded in getting a connection. There is also a big deficit in documentation available online to achieve this kind of setup, so after successfully getting the whole setup working, I documented the guidelines on my blog. The entire setup process is described in detail, peppered with relevant screenshots. I also use CentOS 6.5 64bit, and the guidelines reflect that. It has even been tested against Magento.
如何通過Vagrant在PhpStorm中配置Xdebug一個>
這篇關于xdebug 連接到客戶端超時.:-( 使用 phpstorm 7.1.3/vagrant/virtualbox/magento的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!