php - 在 Vagrant 中使用 XDEBUG

标签 php vim nginx vagrant xdebug

我当前的 XDEBUG 设置是 -

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

我正在 vagrant box 下运行 XDEBUG、NGINX 和 PHP。我正在使用 VIM vagrant 插件。我可以通过 SSH 进入 vagrant box,并在运行 vim vagrant 插件时在端口 9000 创建到主机的 telnet 连接,它会挂起该插件,直到我关闭 telnet,所以我知道可以进行通信。

但是,当我尝试在传递 localbox/phpinfo.php?XDEBUG_SESSION_START=1 时连接到 URL

更新 - 我现在可以使用 Vdebug for VIM 进行连接。但是,页面会挂起几秒钟,然后返回错误 502 BAD gateway。 Nginx 将错误报告为

[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"

有人知道如何调试对等方的重置连接吗?

最佳答案

您确实已连接。 Nginx 正在关闭该进程,因为它认为该进程已挂起。

fastcgi_read_timeout 300;

将值设置得更高,以便更好地进行调试。在 vdebug 中,您将需要添加路径映射

关于php - 在 Vagrant 中使用 XDEBUG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31712847/

相关文章:

php - 如果数组键是连续的,则将默认值添加到数组以填补索引之间的空白

Vim:重新格式化和重新缩进注释的自动方式?

php - 如何在 php-fpm 中启用套接字扩展?

Nginx + php-fpm : 504 timeout error - upstream timed out (110: Connection timed out)

php - 如何在 php 中将特定的星期几增加一个?

PHP 错误的文件夹? include_path ='.:/usr/share/php:/usr/share/pear'

php - 仅允许 WYSIWYG BBCode 编辑器中的 html 标签

vim - 使用 vim 作为编辑器,而使用 emacs 作为代码格式化程序

具有新键盘布局的 vim 键绑定(bind)

Symfony2 应用程序在 kernel.request 和 kernel.controller 之间总是有 3 秒的等待