Vagrant 设置PhpStorm+;流浪汉+;Xdebug

Vagrant 设置PhpStorm+;流浪汉+;Xdebug,vagrant,phpstorm,xdebug,Vagrant,Phpstorm,Xdebug,我已经在尝试在流浪的虚拟机上设置调试过程时撞到了墙上。 我的主机上有Windows8.1,来宾机上有Ubuntu14 这是我的xdebug.ini: zend_extension="/usr/lib/php5/20121212/xdebug.so" xdebug.remote_log=/var/xdebug.log xdebug.remote_host="10.0.2.2" xdebug.remote_port="8000" xdebug.remote_enable=1 xdebug.remo

我已经在尝试在流浪的虚拟机上设置调试过程时撞到了墙上。 我的主机上有Windows8.1,来宾机上有Ubuntu14

这是我的xdebug.ini:

zend_extension="/usr/lib/php5/20121212/xdebug.so"

xdebug.remote_log=/var/xdebug.log
xdebug.remote_host="10.0.2.2"
xdebug.remote_port="8000"
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_handler="dbgp"
xdebug.idekey=vagrant
但在日志文件中,我看到这样的消息:

Log opened at 2014-11-13 04:32:18
I: Checking remote connect back address.
I: Remote address found, connecting to 10.10.10.1:9000.
E: Time-out connecting to client. :-(
Log closed at 2014-11-13 04:32:18
为什么有不同的ip和端口? 我已经搜索过可以覆盖它的地方,但是运气不好。在php.ini中,我什么也没找到

同样奇怪的是:在PHPStorm的路径映射设置中,斜杠被后斜杠替换了。我不知道,是不是出了问题

编辑:这里是php-i | grepxdebug的结果

24:/etc/php5/cli/conf.d/20-xdebug.ini,
47:    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
767:xdebug
769:xdebug support => enabled
777:xdebug.auto_trace => Off => Off
778:xdebug.cli_color => 0 => 0
779:xdebug.collect_assignments => Off => Off
780:xdebug.collect_includes => On => On
781:xdebug.collect_params => 0 => 0
782:xdebug.collect_return => Off => Off
783:xdebug.collect_vars => Off => Off
784:xdebug.coverage_enable => On => On
785:xdebug.default_enable => On => On
786:xdebug.dump.COOKIE => no value => no value
787:xdebug.dump.ENV => no value => no value
788:xdebug.dump.FILES => no value => no value
789:xdebug.dump.GET => no value => no value
790:xdebug.dump.POST => no value => no value
791:xdebug.dump.REQUEST => no value => no value
792:xdebug.dump.SERVER => no value => no value
793:xdebug.dump.SESSION => no value => no value
794:xdebug.dump_globals => On => On
795:xdebug.dump_once => On => On
796:xdebug.dump_undefined => Off => Off
797:xdebug.extended_info => On => On
798:xdebug.file_link_format => no value => no value
799:xdebug.idekey => vagrant => vagrant
800:xdebug.max_nesting_level => 100 => 100
801:xdebug.overload_var_dump => On => On
802:xdebug.profiler_aggregate => Off => Off
803:xdebug.profiler_append => Off => Off
804:xdebug.profiler_enable => Off => Off
805:xdebug.profiler_enable_trigger => Off => Off
806:xdebug.profiler_output_dir => /tmp => /tmp
807:xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
808:xdebug.remote_autostart => Off => Off
809:xdebug.remote_connect_back => On => On
810:xdebug.remote_cookie_expire_time => 3600 => 3600
811:xdebug.remote_enable => On => On
812:xdebug.remote_handler => dbgp => dbgp
813:xdebug.remote_host => 10.0.2.2 => 10.0.2.2
814:xdebug.remote_log => /var/xdebug.log => /var/xdebug.log
815:xdebug.remote_mode => req => req
816:xdebug.remote_port => 10000 => 10000
817:xdebug.scream => Off => Off
818:xdebug.show_exception_trace => Off => Off
819:xdebug.show_local_vars => Off => Off
820:xdebug.show_mem_delta => Off => Off
821:xdebug.trace_enable_trigger => Off => Off
822:xdebug.trace_format => 0 => 0
823:xdebug.trace_options => 0 => 0
824:xdebug.trace_output_dir => /tmp => /tmp
825:xdebug.trace_output_name => trace.%c => trace.%c
826:xdebug.var_display_max_children => 128 => 128
827:xdebug.var_display_max_data => 512 => 512
828:xdebug.var_display_max_depth => 3 => 3

好的,通过将
remote\u connect\u back
选项设置为
Off
解决了我的问题。重要提示:我使用了PuPHPet来生成Vagrant配置文件,但我不知道,在PuPHPet配置文件中,有xDebug配置。因此,主机和端口始终分别为10.10.10.10和9000。因此,似乎所有配置都必须由初始的Vagrant配置完成,而不是之后的SSH。

1)显示
phpinfo()
输出的xdebug部分。2) 暂时忽略斜杠——让我们先让连接工作。到目前为止,您提供的信息表明您在某处有
xdebug.remote\u connect\u back=1
。在哪里这是一个棘手的问题,因为一些发行版/安装程序有1)在CLI中运行的php和在Apache中运行的php的单独php.ini,2)可能从多个文件夹中加载额外的.ini文件。对于#2——检查
phpinfo()
output的标题。我已经从phpinfo添加了数据。奇怪的是,有xdebug.remote\u connect\u back=On indeed1)检查
phpinfo()
输出的头,查看已处理的.ini文件列表。2) 确保此
phpinfo()
通过与非工作调试相同的方式(CLI或web)获得(因为diff环境可能会加载diff配置)3)检查项目中的.htaccess和其他.ini文件——可以使用这些文件传递某些参数(检查
user_ini.filename
选项)考虑到
809:xdebug.remote\u connect\u back=>On=>On
On
两次,它不太可能是本地文件(如前面评论中的#3所示)