Skip to content

Extension is not working with XDebug 3.4.2 installed in Docker container #993

Open
@balda38

Description

@balda38

PHP version: 8.1.31
XDebug version: 3.4.2
Extension version: 1.35.0

Launch.json:

{
    "name": "Listen for XDebug on Docker",
    "type": "php",
    "request": "launch",
    "port": 9003,
    "pathMappings": {
        "/var/www/html": "${workspaceFolder}"
    },
    "xdebugSettings": {
        "max_data": -1
    }
}

XDebug config:

zend_extension = xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.discover_client_host = 1
xdebug.client_host = host.docker.internal
xdebug.client_port = 9003

XDebug log:

Log opened at 2025-03-25 08:23:37.457761
[33] [Config] WARN: Not setting up control socket with default value due to unavailable 'tsc' clock
[33] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_FORWARDED_FOR,REMOTE_ADDR'.
[33] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[33] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[33] [Step Debug] WARN: Could not discover client host through HTTP headers, connecting to configured address/port: host.docker.internal:9003.
[33] [Step Debug] INFO: Connected to debugging client: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port).
[33] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/artisan" language="PHP" xdebug:language_version="8.1.31" protocol_version="1.0" appid="33" idekey="XDebug Docker"><engine version="3.4.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2025 by Derick Rethans]]></copyright></init>

I can assume that everything is fine here. But every time i try to debug the code, the VS code debug console shows me the following error: "Failed initializing connection 2: connection closed (on close)" and ofc nothing happens.

I've already tried different ports (even though nothing uses 9003) and different hosts (local ip of the docker container too). But i was only able to debug the code in two cases:

  • outside the container, using exactly the same config on my machine
  • after manually downgrading xdebug inside the container (tested on 3.1.2)

There doesn't seem to be any breaking changes in xdebug 3.4.2 or earlier in terms of its config. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions