If "hostname": "0.0.0.0"
is not set in the VSCode launch configuration, breakpoints are not hit.
- Build with
docker build -t php-xdebug-docker .
- Run in interactive mode with
docker run -it -p 9003:9003 php-xdebug-docker /bin/bash
- Run XDebug launch script in VSCode that looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/tmp": "${workspaceFolder}"
},
"log": true
}
]
}
- Set a breakpoint in
index.php
- From the bash terminal in the container, execute the PHP script with
php /tmp/index.php
- See that breakpoints set in
index.php
are not hit