问题描述
有一段时间,我使用 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-causes-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 引入了一层在标准的非虚拟化开发环境中不存在的复杂性.虽然以上几点可能是正确的,但为了通过 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!