Skip to content

XDebug connection drops when host IP address changes #43

Description

@pfrenssen

This is the same issue as reported in lando/lando#1700. There is now a solution for this.

Currently when the PHP container is built XDebug is configured using the current host IP address in the XDEBUG_CONFIG environment variable (ref.

const xdebugConfig = host => ([
).

Example:

XDEBUG_CONFIG: client_host=192.168.1.116 discover_client_host=1 log=/tmp/xdebug.log remote_enable=true remote_host=192.168.1.116

Since the IP address is hardcoded this causes the XDebug connection to be lost when the host address changes (e.g. when switching to a different wifi network).

At the moment the only way to fix it is to run lando rebuild which will update the environment variables.

In the original issue it was mentioned (lando/lando#1700 (comment)) that the best solution would be to use host.docker.internal instead of hardcoding the IP but at the time the issue was created this was not yet supported in Linux. Support for this has been added in Docker version 20.10 (moby/moby#40007).

One potential snag is that on Linux the following host needs to be added to the Docker configuration: host.docker.internal:host-gateway. This is not needed on Windows and OSX.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions