我正在使用puppet进行配置,设置Vagrant环境。与一个问题卡在一起,我希望在运行`vagrant up`时,能使xdebug自动运行。但是,在php.ini文件中需要指定主机的IP地址作为`xdebug.remote_host`,由于这个值在每台计算机上都不同,所以希望在发出`vagrant up`命令时自动更新该值。请参照下方的VagrantFile格式进行配置。
config.vm.network :forwarded_port, guest: 9000, host: 9000
.ini设置:
'xdebug.default_enable=1',
'xdebug.remote_enable=1',
'xdebug.remote_handler=dbgp',
'xdebug.remote_host=localhost:9000',
'xdebug.remote_port=9000',
'xdebug.remote_autostart=0',
'xdebug.max_nesting_level=250'
我也尝试了使用xdebug.remote_host=localhost
vagrant虚拟机的ifconfig结果:
vagrant@precise64 ~ : ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:cf:f9:89
inet addr:192.168.61.142 Bcast:192.168.61.255 Mask:255.255.255.0
phpinfo()
REMOTE_ADDR 192.168.61.2
REMOTE_PORT 51886
为了确认,如果我将remote_host
设置为我的OSX主机上的实际IP地址,它会正常工作。