本文介绍了轮询成功,但出错:操作正在进行中(29).当Xdebug尝试从docker容器连接到PhpStorm时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试CLI脚本,而Xdebug无法连接到PhpStorm.
我在Xdebug远程日志中看到错误Operation now in progress (29)..
我确定Xdebug配置正确,但是我不知道如何调试PhpStorm.

I'm trying debug CLI script, and Xdebug can't connect to PhpStorm.
I see error Operation now in progress (29). in Xdebug remote log.
I'm sure Xdebug configured right, but I don't know how to debug PhpStorm.

https://xdebug.org/wizard.php 生成的phpinfo()的摘要

Summary from phpinfo() generated by https://xdebug.org/wizard.php

Tailored Installation Instructions
Summary
Xdebug installed: 2.6.1
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 7.1.24
Zend API nr: 320160303
PHP API nr: 20160303
Debug Build: no
Thread Safe Build: no
OPcache Loaded: no
Configuration File Path: /usr/local/etc/php
Configuration File: /usr/local/etc/php/php.ini
Extensions directory: /usr/local/lib/php/extensions/no-debug-non-zts-20160303
You're already running the latest Xdebug version

Xdebug日志

Log opened at 2019-02-19 11:59:37
I: Connecting to configured address/port: 46.201.50.194:9000.
W: Creating socket for '46.201.50.194:9000', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2019-02-19 11:59:37

Xdebug配置

xdebug

xdebug support => enabled
Version => 2.6.1
IDE Key => PHPSTORM

Supported protocols
DBGp - Common DeBuGger Protocol

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.filename_format => no value => no value
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.gc_stats_enable => Off => Off
xdebug.gc_stats_output_dir => /tmp => /tmp
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => PHPSTORM => PHPSTORM
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
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_addr_header => no value => no value
xdebug.remote_autostart => On => On
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 127.0.0.1 => localhost
xdebug.remote_log => /app/xdebug.log => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.remote_timeout => 200 => 200
xdebug.scream => Off => Off
xdebug.show_error_trace => 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

推荐答案

Xdebug无法连接到PhpStorm,因为我的外部主机ip无法访问PhpStorm.我如何调试它.首先,我从Docker容器检查了PhpStorm侦听端口(在我的情况下为9000)

Xdebug can't connect to PhpStorm because PhpStorm was not reachable by my external host ip.How I debug it.First I checked from docker container that PhpStorm listen port (9000 in my case)

nc -vz external_ip 9000

它得到了(tcp) failed: Connection refused
我从主机尝试了同样的方法,也收到了错误消息然后我从主持人那里尝试过

It got (tcp) failed: Connection refused
I try the same from the host and also got the errorThen I tried from host

nc -vz localhost 9000

我得到了[tcp/*] succeeded!因此,xdebug.remote_host中的问题可能不在PhpStorm中

And I got [tcp/*] succeeded!So the problem in xdebug.remote_host not in PhpStorm probably

我在容器中找到了主机ip

I found host ip in container

netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}'

将其放在xdebug.remote_host中,现在可以正常工作

Put it in xdebug.remote_host and now it works correctly

感谢@LazyOne

Thanks for @LazyOne

这篇关于轮询成功,但出错:操作正在进行中(29).当Xdebug尝试从docker容器连接到PhpStorm时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 02:06