Xdepuración: [Step Debug] No se pudo conectar con el cliente de depuración. Intenté: localhost: 9003 (retroceso a través de xdebug.client_host/xdebug.client_port) :-(

14 minutos de lectura

Avatar de usuario de Fil
Fil

¿Cuál es la solución de este mensaje para xdebug ang php?

Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(

Este mensaje aparece cuando corro composer update en WSL2 instalado con UBUNTU 20.01.

Mi versión actual de php es php8 y xdebug3

Actualizar:

Esta es la sección de depuración x

xdebug

__   __   _      _
\ \ / /  | |    | |
 \ V / __| | ___| |__  _   _  __ _
  > < / _` |/ _ \ '_ \| | | |/ _` |
 / . \ (_| |  __/ |_) | |_| | (_| |
/_/ \_\__,_|\___|_.__/ \__,_|\__, |
                              __/ |
                             |___/

Version => 3.0.1
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support

Feature => Enabled/Disabled
Development Aids => ✘ disabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger => ✔ enabled
Tracing => ✘ disabled

Debugger => enabled
IDE Key =>

Directive => Local Value => Master Value
xdebug.auto_trace => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.auto_trace" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.auto_trace"
xdebug.cli_color => 0 => 0
xdebug.client_discovery_header => no value => no value
xdebug.client_host => localhost => localhost
xdebug.client_port => 9003 => 9003
xdebug.cloud_id => no value => no value
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_includes" => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_includes"
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_vars" => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_vars"
xdebug.connect_timeout_ms => 200 => 200
xdebug.coverage_enable => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.coverage_enable" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.coverage_enable"
xdebug.default_enable => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.default_enable" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.default_enable"
xdebug.discover_client_host => 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.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 => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_enable" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_enable"
xdebug.gc_stats_output_dir => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_output_dir" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_output_dir"
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => no value => no value
xdebug.log => no value => no value
xdebug.log_level => 7 => 7
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.mode => debug => debug
xdebug.output_dir => /mnt/c/www/traces => /mnt/c/www/traces
xdebug.overload_var_dump => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.overload_var_dump" => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.overload_var_dump"
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable"
xdebug.profiler_enable_trigger => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger"
xdebug.profiler_enable_trigger_value => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger_value" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger_value"
xdebug.profiler_output_dir => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_output_dir" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_output_dir"
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_autostart" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_autostart"
xdebug.remote_connect_back => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_connect_back" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_connect_back"
xdebug.remote_enable => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_enable" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_enable"
xdebug.remote_host => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_host" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_host"
xdebug.remote_log => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log"
xdebug.remote_log_level => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log_level" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log_level"
xdebug.remote_mode => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_mode" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_mode"
xdebug.remote_port => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_port" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_port"
xdebug.remote_timeout => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_timeout" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_timeout"
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 => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.show_mem_delta" => This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.show_mem_delta"
xdebug.start_upon_error => default => default
xdebug.start_with_request => 1 => 1
xdebug.trace_enable_trigger => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger"
xdebug.trace_enable_trigger_value => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger_value" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger_value"
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_output_dir" => This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_output_dir"
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.trigger_value => no value => no value
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3

  • Podría ser su configuración de Xdebug o PHP. Quiero decir, la razón por la que está impreso en la consola (ya que estaba destinado a imprimirse solo en el registro de errores). Por favor muestra php -i (que es lo mismo que phpinfo()) – principalmente interesado en la sección Xdebug y PHP central (relacionado con el registro de errores) por el momento.

    – LazyOne

    9 de diciembre de 2020 a las 12:59

  • En cuanto a “por qué está ahí de todos modos” … debe estar teniendo xdebug.start_with_request = yes (que es lo mismo que xdebug.remote_autostart = yes para Xdebug v2), le dice a Xdebug que intente depurar cada guion independientemente del indicador “depurarme”. Intente deshabilitarlo y use la depuración solo a pedido (por ejemplo, cuando comience desde su IDE / conjunto de cookies por la extensión del navegador Xdebug).

    – LazyOne

    9 de diciembre de 2020 a las 13:02

  • Sí… Acabo de actualizar la pregunta con información de depuración x.

    – Fil

    11 de diciembre de 2020 a las 2:27

  • Sí, funciona. quitando xdebug.start_with_request = yes arregló el problema

    – Fil

    11 de diciembre de 2020 a las 2:30

  • Por favor, muestre cuál es el valor error_log La configuración de PHP tiene (por ejemplo, de phpinfo(); salida o simplemente ini_get('error_log');). Apuesto a que estará vacío (o quizás alguna ubicación incorrecta).

    – LazyOne

    11 de diciembre de 2020 a las 17:15


Avatar de usuario de LazyOne
LazyOne

Lo que causa ese mensaje en primer lugar:

Tú tienes xdebug.start_with_request = yes (que es lo mismo que xdebug.remote_autostart = yes para Xdebug v2). Esta opción le dice a Xdebug que intente depurar cada solicitud/guión independientemente del indicador “depurarme”.

Si Xdebug no puede conectarse al cliente de depuración (valores de xdebug.client_host & xdebug.client_port .. o host autodetectado si xdebug.discover_client_host está habilitado), luego le notifica al respecto.

Cómo evitar que aparezca en mi pantalla/en la salida:

Xdebug usa rutinas estándar de PHP para escribir tales advertencias (p. ej. PHP estándar error_log() función). Normalmente, dicho mensaje se escribirá en el estándar Registro de errores de PHP. Parece que no lo tienes configurado en absoluto en tu php.ini (valor vacío), por lo tanto, PHP lo envía a su salida estándar (por lo que aún puede tener la oportunidad de verlo, ya que podría ser importante).

La solución es señalar PHP error_log configuración inicial a alguna ubicación válida para que pueda leerlo cuando sea necesario (la ruta depende de su sistema operativo y distribución, por ejemplo error_log = /var/log/php_error.log sería muy común). Si no necesita dicho registro en absoluto (tiene otro sistema de registro en su lugar), use /dev/null o algo similar en su lugar.


También puedes probar xdebug.log_level = 0 pero esto debería evitar que Xdebug registre nada, incluso si especifica xdebug.log.


Por favor vea también esta explicación del autor de Xdebug sobre “por qué funciona de esta manera”: https://stackoverflow.com/a/65670743/783119

  • Gracias por señalar esto, aunque funciona con la eliminación xdebug.start_with_request = yes esto también es útil porque de vez en cuando a veces uso ini_set('display_errors', 1); para mostrar al principio de la secuencia de comandos si algo no se detecta.

    – Fil

    12 de diciembre de 2020 a las 11:55

  • xdebug.log_level=0 fue la solución para mí.

    – Ryan Nerd

    12 dic 2020 a las 14:35

  • Gracias. En mi caso, estos errores subyacentes de Xdebug causaban a su vez errores de phpcs del tipo phpcs: Unknown error ocurred. Please verify that C:\Users\Nick\AppData\Roaming\Composer\vendor\bin\phpcs.bat --report=json -q --encoding=UTF-8 --error-severity=6 --warning-severity=6 C:\Bitnami\wampstack-7.4.12-0\apache2\htdocs\myfile.php - returns a valid json object. No quiero que se acumule un archivo de registro enorme y olvidado, por lo que configurar xdebug.log_level=0 está funcionando para mí, aunque, como principiante, estoy un poco preocupado por los errores importantes de Xdebug que podría pasar por alto.

    – Nick Esperanza

    24 mayo 2021 a las 18:42

  • @NickHope Nada importante AFAIK. Si la depuración ya le funciona bien, no se perderá nada importante.

    – LazyOne

    24 mayo 2021 a las 19:59

  • @LazyOne tengo un error_log ruta establecida en mi php.ini pero todavía recibía el mismo error en mi consola. tuve que configurar xdebug.log_level=0 para arreglarlo. Pero ahora no recibiré ningún resultado en mi error_log camino si algo sale mal?

    – CodeConnoisseur

    22 de julio de 2021 a las 20:32

Avatar de usuario de Volex
Volex

Estoy usando:
xdebug.start_with_request=trigger
para activar xdebug cuando lo necesito (con el uso de la extensión xdebug del navegador para la depuración del servidor web).

O si necesito depurar el script php (usando cli), uso phpstorm con una configuración como esta:

ingrese la descripción de la imagen aquí

Con este enfoque, no obtengo este error y puedo usar los registros de xdebug como siempre.

Desde el documentación de Xdebug sobre este tipo de errores:

Ocurre cuando Xdebug intenta conectarse a un cliente de depuración para iniciar una sesión de depuración.

El depurador no pudo establecer una conexión con el cliente. El mensaje de error indica qué combinaciones de host y puerto se probaron y mediante qué opciones de configuración se llegó a esa conclusión.

Un ejemplo:

No se pudo conectar con el cliente de depuración. Intentado: ::1:9003 (de REMOTE_ADDR cabecera HTTP), localhost:9003 (retroceder a través de xdebug.client_host/xdebug.client_port)

Este mensaje indica que Xdebug primero intentó usar ::1:9003 (host local de IPv6) desde el encabezado REMOTE_ADDR, y luego volvió a localhost:9003 como configurado con xdebug.client_host y xdebug.client_port.

Las soluciones sugeridas:

  • Compruebe si su cliente de depuración está escuchando en la dirección y el puerto indicados. En Linux y OSX, puede usar netstat -a -n | grep LISTEN verificar.
  • Cambio xdebug.client_host y/o xdebug.client_port a la dirección/nombre de host y puerto correctos donde escucha el cliente de depuración.

  • Oh, esto también es útil para determinar dónde está escuchando usando netstat -a -n | grep LISTEN

    – Fil

    12 de diciembre de 2020 a las 12:39

Deshabilite la extensión del navegador xdebug cuando no la esté usando.

Yo uso el depurador VSCode. Cuando la depuración estaba desactivada en el IDE, veía el error en el registro en cada visita a la página porque la extensión de mi navegador Chrome aún intentaba invocar xdebug.

Esto sucede a pesar de tener una buena configuración de php.ini para xdebug como:

xdebug.mode=debug

o

xdebug.start_with_request=trigger

Ambos documentados aquí: Xdebug: Documentación

¿Ha sido útil esta solución?