phpvisual-studio-codexdebug

VS Code Debugger - Felix Becker - Debugger doesn't hit anything


I have recently installed php debugger by Felix Becker. No matter whatever config settings I do, my debugger is not hitting anything. Following are my conf files.

xdebug.ini

[xdebug]
; debug
xdebug.default_enable = $value
xdebug.remote_autostart = $value
xdebug.remote_connect_back = 0
xdebug.remote_host = $value
xdebug.remote_port = $value
xdebug.remote_enable = 1
xdebug.idekey = $value

; profiling
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = /tmp

zend_extension=xdebug.so

Launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9009,
            "pathMappings": {
                "path/path": "$value"
            }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
  
            "port": 9009,
            "pathMappings": {
                "path/path": "$value"
            }
        }
    ]
  }

Am I missing anything here ?


Solution

  • Xdebug v3.0.1, by Derick Rethans

    You are using Xdebug v3 but keep using Xdebug v2 config parameters. You need to go through Upgrading from Xdebug 2 to 3 Guide and adjust your settings (mostly just change the parameter name).

    Xdebug v3 uses different config params than Xdebug v2. From what I see 8 out of 9 "xdebug." params from your current php.ini do nothing in Xdebug v3.

    For Xdebug 3 it should be something like this (based on your original config):

    zend_extension=xdebug.so
    
    [xdebug]
    xdebug.mode = debug
    ; for profiling switch to below:
    ;xdebug.mode = profile
    
    xdebug.client_host = ${PHP_XDEBUG_REMOTE_HOST}
    xdebug.client_port = ${PHP_XDEBUG_REMOTE_PORT}
    xdebug.discover_client_host = false
    xdebug.start_with_request = ${PHP_XDEBUG_REMOTE_AUTOSTART}
    xdebug.idekey = ${PHP_XDEBUG_IDE_KEY}
    xdebug.output_dir = /tmp
    

    P.S. xdebug.discover_client_host will now fallback to xdebug.client_host on failure (unlike v2 that would try autodetected host only).

    P.P.S. xdebug.default_enable = 1 is replaced by xdebug.mode = develop. If you need that then you can list multiple values via comma, e.g. xdebug.mode = develop,debug