For PHP development I'm using a docker LAMP image and configured XDebug inside Apache so it is running. On the host system I'm using Ubuntu with VSCode (version 1.95.1)
When Xdebug is hitting the breakpoint in my token.php code, VSCode has issues to open the file:
Where the path for /app/backend/models/Token.php is coming from? The file itself is located here:
/home/butti/repo/backend/app/backend/models/Token.php
In the Xdebug everything seems to be fine and also the variable watch is working (log level 10):
I'm wondering if I need to setup a different path in launch.json at this part:
"cwd": "${workspaceRoot}",
"pathMappings": {
"/var/www/html": "${workspaceRoot}"
},
I tried to replace ${workspaceRoot} with a fixed path, but then either VSCode is not stopping at the breakpoint or above file could not be found by VSCode to show up.
I added to the pathMappings a ./ so the right file should be found:
"cwd": "${workspaceRoot}",
"pathMappings": {
"/var/www/html": "./${workspaceRoot}"
},
When running the debugger and setting the breakpoint, it is - as usual - red:
... and when it gets hit, then it becomes transparent without stopping the code:
...and in the xdebug.log it says:
[32] [Step Debug] WARN: Breakpoint file name does not exist: /home/butti/repo/backend/app/backend/models/Token.php (No such file or directory).
[32] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="9" id="320002" resolved="unresolved"></response>
But actually the file on my host system (where VSCode is running) is there and has read/write permissions:
$: ls -la Token*
-rw-rw-rw- 1 butti staff 3273 Nov 6 13:37 Token.php
$: pwd
/home/butti/repo/backend/app/backend/models
Any further suggestions where I need to have a look at?
My setup:
- launch.json configuration for docker debugging:
{
"name": "Listen on Docker for Xdebug",
"type": "php",
"request": "launch",
"hostname": "192.168.178.111",
"port": 9003,
"log": true,
"cwd": "${workspaceRoot}",
"ignore": [
"**/vendor/**/*.php"
],
"pathMappings": {
"/var/www/html": "${workspaceRoot}"
},
"xdebugSettings": {
"max_data": 65536,
"show_hidden": 1,
"max_children": 100,
"max_depth": 3
//"resolved_breakpoints": "0"
},
},
- Host system: Ubuntu 24.04.1 LTS; VSCode 1.95.1 with PHP Debug v1.35.0
- LAMP stack on Docker image mattrayner/lamp:latest which is enhanced to PHP 8.3.13 and Apache
php -vin docker gives:
PHP 8.3.13 (cli) (built: Oct 30 2024 11:27:07) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.13, Copyright (c) Zend Technologies
with Zend OPcache v8.3.13, Copyright (c), by Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
apache2 -vin docker gives:
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2024-07-17T18:58:09




