So first of all since October for some reason my previously working Xdebug config for VSCode + Docker stopped working.
I switched over to an Xdebug 3 config to try it out, since 2.9 appears to have stopped working for me. Maybe because of a VSCode or PHP Debug plugin update?
But so far I have been unable to get it working or get it working only half?
VSCode launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"externalConsole": false,
"pathMappings": {
"/var/www/html/backend": "${workspaceRoot}",
},
"xdebugSettings": {
"resolved_breakpoints": "0",
"max_data": -1,
"max_children": -1,
"max_depth": -1
},
"ignore": [
"**/vendor/**/*.php"
]
}
]
}
xdebug.ini in Docker (LAMP):
zend_extension=xdebug.so
xdebug.idekey = VSCODE
xdebug.mode = debug,profile,trace
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.client_host=host.docker.internal
xdebug.profiler_enable_trigger = 1
xdebug.profiler_enable = 0
xdebug.remote_enable = 1
xdebug.profiler_output_dir = "/tmp"
xdebug.log:
My breakpoint is on module.class.php:209
[17] Log opened at 2021-12-16 15:36:39.557066
[17] [Step Debug] INFO: Connecting to configured address/port: host.docker.internal:9003.
[17] [Step Debug] INFO: Connected to debugging client: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port). :-)
[17] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/company_v2_backend/index.php" language="PHP" xdebug:language_version="7.2.34" protocol_version="1.0" appid="17" idekey="VSCODE"><engine version="3.1.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[17] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
[17] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
[17] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
[17] [Step Debug] <- feature_set -i 4 -n resolved_breakpoints -v 0
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="resolved_breakpoints" success="1"></response>
[17] [Step Debug] <- feature_set -i 5 -n max_data -v -1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="max_data" success="1"></response>
[17] [Step Debug] <- feature_set -i 6 -n max_children -v -1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="max_children" success="1"></response>
[17] [Step Debug] <- feature_set -i 7 -n max_depth -v -1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="7" feature="max_depth" success="1"></response>
[17] [Step Debug] <- breakpoint_set -i 8 -t line -f file:///var/www/html/backend/classes/data/module.class.php -n 209
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="8" id="170001"></response>
[17] [Step Debug] <- run -i 9
[17] [Step Debug] DEBUG: Checking whether to break on /var/www/html/backend/classes/data/module.class.php:209.
[17] [Step Debug] DEBUG: I: Current location: /var/www/html/company_v2_backend/index.php:10.
[17] [Step Debug] DEBUG: I: Matching breakpoint '/var/www/html/backend/classes/data/module.class.php:209' against location '/var/www/html/company_v2_backend/index.php:10'.
[17] [Step Debug] DEBUG: R: File name length (41) doesn't match with breakpoint (51).
[17] [Step Debug] DEBUG: Checking whether to break on /var/www/html/backend/classes/data/module.class.php:209.
[17] [Step Debug] DEBUG: I: Current location: /var/www/html/company_v2_backend/index.php:11.
[17] [Step Debug] DEBUG: I: Matching breakpoint '/var/www/html/backend/classes/data/module.class.php:209' against location '/var/www/html/company_v2_backend/index.php:11'.
[17] [Step Debug] DEBUG: R: File name length (41) doesn't match with breakpoint (51).
[17] [Step Debug] DEBUG: Checking whether to break on /var/www/html/backend/classes/data/module.class.php:209.
[17] [Step Debug] DEBUG: I: Current location: /var/www/html/company_v2_backend/index.php:12.
[17] [Step Debug] DEBUG: I: Matching breakpoint '/var/www/html/backend/classes/data/module.class.php:209' against location '/var/www/html/company_v2_backend/index.php:12'.
[17] [Step Debug] DEBUG: R: File name length (41) doesn't match with breakpoint (51).
[17] [Step Debug] DEBUG: Checking whether to break on /var/www/html/backend/classes/data/module.class.php:209.
[17] [Step Debug] DEBUG: I: Current location: /var/www/html/company_v2_backend/index.php:15.
[17] [Step Debug] DEBUG: I: Matching breakpoint '/var/www/html/backend/classes/data/module.class.php:209' against location '/var/www/html/company_v2_backend/index.php:15'.
[17] [Step Debug] DEBUG: R: File name length (41) doesn't match with breakpoint (51).
[17] [Step Debug] DEBUG: Checking whether to break on /var/www/html/backend/classes/data/module.class.php:209.
[17] [Step Debug] DEBUG: I: Current location: /var/www/html/company_v2_backend/index.php:16.
[17] [Step Debug] DEBUG: I: Matching breakpoint '/var/www/html/backend/classes/data/module.class.php:209' against location '/var/www/html/company_v2_backend/index.php:16'.
[17] [Step Debug] DEBUG: R: File name length (41) doesn't match with breakpoint (51).
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="9" status="stopping" reason="ok"></response>
[17] [Step Debug] <- stop -i 10
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="10" status="stopped" reason="ok"></response>
[17] Log closed at 2021-12-16 15:36:39.656857
[17] Log opened at 2021-12-16 15:36:39.676911
[17] [Step Debug] INFO: Connecting to configured address/port: host.docker.internal:9003.
[17] [Step Debug] INFO: Connected to debugging client: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port). :-)
[17] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/company_v2_backend/index.php" language="PHP" xdebug:language_version="7.2.34" protocol_version="1.0" appid="17" idekey="VSCODE"><engine version="3.1.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[17] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
[17] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
[17] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
[17] [Step Debug] <- feature_set -i 4 -n resolved_breakpoints -v 0
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="resolved_breakpoints" success="1"></response>
[17] [Step Debug] <- feature_set -i 5 -n max_data -v -1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="max_data" success="1"></response>
[17] [Step Debug] <- feature_set -i 6 -n max_children -v -1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="max_children" success="1"></response>
[17] [Step Debug] <- feature_set -i 7 -n max_depth -v -1
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="7" feature="max_depth" success="1"></response>
[17] [Step Debug] <- breakpoint_set -i 8 -t line -f file:///var/www/html/backend/classes/data/module.class.php -n 209
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="8" id="170002"></response>
[17] [Step Debug] <- run -i 9
[17] [Step Debug] DEBUG: Checking whether to break on /var/www/html/backend/classes/data/module.class.php:209.
[17] [Step Debug] DEBUG: I: Current location: /var/www/html/company_v2_backend/index.php:10.
[17] [Step Debug] DEBUG: I: Matching breakpoint '/var/www/html/backend/classes/data/module.class.php:209' against location '/var/www/html/company_v2_backend/index.php:10'.
[17] [Step Debug] DEBUG: R: File name length (41) doesn't match with breakpoint (51).
... and it's kind of the same from here on out
EDIT: phpinfo xdebug wizard instructions are:
Download xdebug-3.1.2.tgz
Install the pre-requisites for compiling PHP extensions. These packages are often called 'php-dev', or 'php-devel', 'automake' and 'autoconf'.
Unpack the downloaded file with tar -xvzf xdebug-3.1.2.tgz
Run: cd xdebug-3.1.2
Run: phpize (See the FAQ if you don't have phpize).
As part of its output it should show:
Configuring for:
...
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
Run: ./configure
Run: make
Run: cp modules/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20170718
Update /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini to have the line:
zend_extension = xdebug
Restart the Apache Webserver
Follow these instructions but it doesn't appear to help.