ILikeTurtles
ILikeTurtles

Reputation: 1022

Using XDEBUG in Vagrant

My current XDEBUG settings are -

xdebug

xdebug support  enabled
Version 2.3.2
IDE Key 1
Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $
Directive   Local Value Master Value
xdebug.auto_trace   Off Off
xdebug.cli_color    0   0
xdebug.collect_assignments  Off Off
xdebug.collect_includes On  On
xdebug.collect_params   0   0
xdebug.collect_return   Off Off
xdebug.collect_vars Off Off
xdebug.coverage_enable  On  On
xdebug.default_enable   On  On
xdebug.dump.COOKIE  no value    no value
xdebug.dump.ENV no value    no value
xdebug.dump.FILES   no value    no value
xdebug.dump.GET no value    no value
xdebug.dump.POST    no value    no value
xdebug.dump.REQUEST no value    no value
xdebug.dump.SERVER  no value    no value
xdebug.dump.SESSION no value    no value
xdebug.dump_globals On  On
xdebug.dump_once    On  On
xdebug.dump_undefined   Off Off
xdebug.extended_info    On  On
xdebug.file_link_format no value    no value
xdebug.force_display_errors Off Off
xdebug.force_error_reporting    0   0
xdebug.halt_level   0   0
xdebug.idekey   vagrant vagrant
xdebug.max_nesting_level    256 256
xdebug.max_stack_frames -1  -1
xdebug.overload_var_dump    On  On
xdebug.profiler_aggregate   Off Off
xdebug.profiler_append  Off Off
xdebug.profiler_enable  Off Off
xdebug.profiler_enable_trigger  Off Off
xdebug.profiler_enable_trigger_value    no value    no value
xdebug.profiler_output_dir  /tmp    /tmp
xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
xdebug.remote_autostart On  On
xdebug.remote_connect_back  On  On
xdebug.remote_cookie_expire_time    3600    3600
xdebug.remote_enable    On  On
xdebug.remote_handler   dbgp    dbgp
xdebug.remote_host  10.0.2.2    10.0.2.2
xdebug.remote_log   no value    no value
xdebug.remote_mode  req req
xdebug.remote_port  9000    9000
xdebug.scream   Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars  Off Off
xdebug.show_mem_delta   Off Off
xdebug.trace_enable_trigger Off Off
xdebug.trace_enable_trigger_value   no value    no value
xdebug.trace_format 0   0
xdebug.trace_options    0   0
xdebug.trace_output_dir /tmp    /tmp
xdebug.trace_output_name    trace.%c    trace.%c
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth    3   3

I am running XDEBUG, NGINX, and PHP under a vagrant box. I am using a VIM vagrant plugin. I can SSH into the vagrant box and create a telnet connection to my host machine at port 9000 while running the vim vagrant plugin and it will hang the plugin until I close the telnet, so I know communication is possible.

However, when I try to connect to a URL while passing the localbox/phpinfo.php?XDEBUG_SESSION_START=1

UPDATE - I am now able to connect using Vdebug for VIM. However, the page hangs for several seconds before returning an error 502 BAD gateway. Nginx reports the error as

[error] 20913#0: *3 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.50.1, server: localhost, request: "GET /phpinfo.php?XDEBUG_SESSION_START=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cpd.local"

Does anyone know how to debug a reset connection by peer?

Upvotes: 2

Views: 604

Answers (2)

exussum
exussum

Reputation: 18550

Your actually connected. Nginx is closing the process as it thinks its hanging.

fastcgi_read_timeout 300;

Set the value to be much higher to allow a good time debugging. Inn vdebug you will need to add a path map

Upvotes: 1

Jose B
Jose B

Reputation: 2130

Check if you have any port conflicts with php-fpm. If you are running php-fpm, this listens on port 9000 by default.

I had to change xdebug to listen on a different port (e.g. 9001) on a vagrant machine that was running nginx and php-fpm to avoid port conflicts.

You'll have to restart nginx and php-fpm.

Upvotes: 1

Related Questions