Skip to content

Xdebug setup for DDEV & Visual Studio Code

Steve Taylor edited this page May 17, 2023 · 1 revision

Xdebug

Below is a current known working xdebug config for DDEV. This can be added manually in the DDEV VM, or to a new file in your DDEV project located at .ddev/php/20-xdebug.ini. You will need to run ddev restart for the changes to take effect.

zend_extension=xdebug.so
xdebug.client_host=host.docker.internal
xdebug.client_port=9003 
xdebug.mode=debug,develop
xdebug.start_with_request=trigger
xdebug.max_nesting_level=2000
xdebug.discover_client_host=1
xdebug.log=/tmp/xdebug_remote.log

Visual Studio Code

Create or edit your debug configurations. The default configuration is missing the necessary pathMappings setting. Here is a sample configuration entry with the pathMappings set:

{
    "name": "Listen for Xdebug",
    "type": "php",
    "request": "launch",
    "port": 9003,
    "pathMappings": {
        "/var/www/html/web": "${workspaceRoot}"
    },
}

Clone this wiki locally