使用xDebug在虚拟机上调试项目

时间:2016-02-16 10:09:01

标签: php apache vagrant virtual-machine xdebug

我有Vagrant设置的虚拟机。它的Centos 7.除了Apache和mod_php我安装了xDebug,其配置如下:

[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_enable = On
xdebug.remote_autostart = On
xdebug.remote_handler = dbgp
xdebug.remote_port = 9000
xdebug.remote_mode = req
xdebug.remote_connect_back = On
xdebug.idekey = "netbeans-xdebug"

我为我的项目设置了一个虚拟主机,当我在浏览器中将其拉出时,我开始工作。 xDebug非常有效。

然后我想使用Vagrant Share让我的项目可以从Internet访问。当我启动此服务时,该网站可通过my-temporary-domain.vagrantshare.com获取。一切似乎都很好。但是我无法调试。

我看不到的问题是什么?我应该配置什么来让xDebug完成它的工作?

1 个答案:

答案 0 :(得分:2)

所以我找到了解决方案。

我的来宾计算机具有静态IP 192.168.1.2。我的主人 - 192.168.1.1 当我设置

xdebug.remote_connect_back = Off 

这是默认的,顺便说一句。并制作

xdebug.remote_host = 192.168.1.1

它按预期工作。我认为这是因为xDebug概念我并不完全理解。本文帮助: http://walkah.net/blog/debugging-php-with-vagrant/