设置PhpStorm + Vagrant + Xdebug

时间:2014-11-13 04:39:31

标签: vagrant phpstorm xdebug

我已经试图在Vagrant虚拟机上设置调试过程。 我的主机上有Windows 8.1,客户机上有Ubuntu 14。

这是我的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的路径映射设置中,我用斜线替换了斜线。我不知道,它是否会出现问题。

enter image description here

编辑:这是php -i |的结果grep xdebug

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

1 个答案:

答案 0 :(得分:0)

好的,我的问题已通过将remote_connect_back选项设置为Off来解决。重要说明:我使用PuPHPet生成Vagrant配置文件,我不知道,在PuPHPet配置文件中,xDebug配置存在。因此,主机和端口总是分别为10.10.10.10和9000。因此,似乎所有配置都必须由最初的Vagrant配置完成,而不是之后通过SSH完成。