vscode-php-debug icon indicating copy to clipboard operation
vscode-php-debug copied to clipboard

Docker and xDebug Connecting but not hitting breakpoints

Open joshualawson opened this issue 9 years ago • 2 comments

PHP version: 7.0.12 XDebug version: 2.5.1 Adapter version: 1.10.0

Getting no breakpoints working, also enabled stopOnEntry and still nothing. It seems to make connection fine but does nothing.

I have recreated the docker containers multiple times, deleted my containers and images and rebuilt everything...

I did have this working with an OLDER version of docker using docker-machine and having docker run in a VirtualBox.

I then saw there has been updates for Docker so I decided to update to the latest version 17.x.x and then my debugger stopped working, hence playing around with config files etc.

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "log": true,
            "localSourceRoot": "${workspaceRoot}/src",
            "serverSourceRoot": "/var/www/tipple-core/src"
        }
    ]
}

XDebug php.ini config:

Attempt 1:

xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/profile
xdebug.remote_log=/tmp/xdebug.log

Attempt 2:

This includes setting lo0 to 10.254.254.254

xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host=10.254.254.254
xdebug.remote_connect_back = 0
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/profile
xdebug.remote_log=/tmp/xdebug.log

XDebug logfile (from setting xdebug.remote_log in php.ini):

This is the same output for all of my attempts, I have also reset docker, vscode and my mac and tried BOTH variations of the config. The only different when I use the lo0 config, the ip on the log output matches the IP I set.

Log opened at 2017-04-11 01:26:35
I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Checking header 'REMOTE_ADDR'.
I: Remote address found, connecting to 172.17.0.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/tipple-core/src/index.php" language="PHP" xdebug:language_version="7.0.15-1~dotdeb+8.1" protocol_version="1.0" appid="9" idekey="www-data"><engine version="2.5.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2017 by Derick Rethans]]></copyright></init>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Adapter logfile (from setting "log": true in launch.json):

Same output also as above

<- launchResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 2,
  command: 'launch',
  success: true }

joshualawson avatar Apr 11 '17 01:04 joshualawson

Sorry, but this is a Docker / XDebug issue, not with the adapter. When XDebug logs it connected it logs that because it connected to the Docker bridge, not to VS Code. You are more likely to find help in Docker or XDebug forums than here.

felixfbecker avatar Apr 11 '17 07:04 felixfbecker

I'm getting this problem without Docker being installed. Breakpoints aren't being hit unless I hit pause in the debugger.

geoidesic avatar Aug 01 '20 16:08 geoidesic