Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

914
Vistas
Xdebug: Could not connect to debugging client (Phpstorm + WSL2)

I am trying to convert my recent XAMPP development setup to a LAMP stack based on WSL2.

So far I've been successful. I can access my testpage test.php containing <?php phpinfo(); via https://localhost/test.php (using a self-signed certificate for dev-purposes.)

Sadly, I'm completely stuck at getting Xdebug to work.

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

I have been going through these threads already, but to no avail:

  • First
  • Second
  • Third

My setup:

  • Windows 10 with WSL2 installed
  • Ubuntu 20.04 with Apache2
  • PHP 8.0.5 with Xdebug 3.0.4
  • PhpStorm (IDE)

My Xdebug settings at /etc/php/8.0/apache2/php.ini:

[xdebug]
xdebug.mode=debug
xdebug.remote_port=9003
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.remote_host=localhost
xdebug.idekey=PHPSTORM
xdebug.discover_client_host=1

;xdebug.client_host=localhost
;xdebug.remote_enable=1
;xdebug.remote_handler=dbgp

I have tried commenting "discover_client" and explicitly setting the client host to localhost. No change.

The output of phpinfo() seems to indicate that these settings are not ignored. See screenshot of the relevant parts.

The relevant settings for the virtual host in /etc/apache2/sites-available/default-ssl.conf are:

<VirtualHost: *:443>
    ServerName localhost
    DocumentRoot "/mnt/d/projects/testproject/public"
    <Directory "/mnt/d/projects/testproject/public/">
        Options +Indexes +Includes +FollowSymlinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

(The "all granted" is only temporary while debugging)

I don't know if this is relevant, but I made sure that C:\Windows\System32\drivers\etc\hosts contains

127.0.0.1 localhost
::1 localhost

So when I run

php -dxdebug.mode=debug /mnt/d/projects/testproject/public/test.php

I get

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

Does anyone see the problem? Or can anyone give me a hint on where to look next?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The option xdebug.start_with_request = yes tells Xdebug to try to debug every single request/script. If Xdebug fails to connect to the debug client (it takes values from xdebug.client_host and xdebug.client_port, or autodetected host if xdebug.discover_client_host is enabled) then it notifies you about that.

Normally such a messages will be written to the standard PHP's error log. Looks like you don't have it configured at all in your php.ini (as this is how it comes by default), therefore PHP sends it to your standard output instead.

If you want to prevent it from appearing on you terminal output you have to point the PHP error_log to a valid location.

Example of how I solved it in my case:

1- Edit your ini file:

sudo vi /etc/php/7.4/cli/php.ini

2- And add this line:

error_log = /var/www/log/php_error.log

NOTE: Change the previous routes to any valid directory you want.

3- Try again and the warning should disappear and now goes to the log file.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda