Skip to content

Instantly share code, notes, and snippets.

@ctf0
Last active April 26, 2022 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctf0/3f4bda8c3e0b4216cc2a7411dbc9aec4 to your computer and use it in GitHub Desktop.
Save ctf0/3f4bda8c3e0b4216cc2a7411dbc9aec4 to your computer and use it in GitHub Desktop.
docker php xdebug setup for vscode (insider)
  1. open terminal and run

    export XDEBUG_CONFIG="idekey=VSCODE"
  2. install xdebug for vscode

  3. add launch config

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Listen for Xdebug",
                "type": "php",
                "request": "launch",
                "port": 9003,
                "pathMappings": {
                    "/var/www/html": "${workspaceFolder}",
                }
            }
        ]
    }
  4. run php --ini | grep "xdebug" on docker image

  5. add below to xdebug.ini

    zend_extension=xdebug.so
    xdebug.mode=debug
    xdebug.start_with_request=yes
    xdebug.discover_client_host=true

    PS:

    • incase of laravel/sail, u dont need the above config, just make sure to run the command with debug ex.
      • normal: sail test ....
      • debug: sail debug test ....
  6. add breakpoints

  7. run the debugger on vscode

  8. run ur command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment