I've read most all of the posts about setting up PHP Xdebug for VS Code but no solution for me. I've installed VS Code on a new laptop (that's relevant because I know what else is installed and there are no multiple instances of PHP - but there seems to be!)
I've installed XAMPP, which includes PHP 8.2.12 on a Windows 11 PC.
The php -v shows :
PHP 8.2.12 (cli) (built: Oct 24 2023 21:15:15) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
The php.ini says:
zend_extension = c:\xampp\php\ext\php_xdebug.dll
xdebug.start_with_request = yes
xdebug.client_port = 9900
xdebug.client_host = 127.0.0.1
xdebug.default_enable=1
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_log="C:\xampp\apache\logs\xdebug.log"
The json settings in VS Code are:
{
"workbench.colorTheme": "Visual Studio Light",
"debug.allowBreakpointsEverywhere": true,
"php.executables": { "v8.2": "//xampp//php//php.exe" },
"launch": {
"configurations": [ {
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9900,
"pathMappings": {
"c:/xampp/php/ext": "${workspaceFolder}"
}
}
]]
}
}
According to all the posts I've read that should do it, but when trying to debug a simple PHP I get this error:
Failed loading C:\php\ext\php_xdebug-2.6.1-7.2-vc15-nts-x86_64.dll
Now I'm no expert, but this seems to be saying its trying to run PHP 7.2 and wants the Xdebug 2.6.1. non thread safe xdebug.dll.
But I can find NO other instance of php.exe on the PC - where in VS Code is it looking for c:\php\ext\ a folder which doesn't exist. I cant find in VS Code where such settings exist or how to tell VS Code to look in right folder (in this case c:\xampp\php\ext)
FWIW I'm using RobertLu's PHP debug extension though, I've tried all others available. On previous laptop some time ago I did have some success using Felix Beckers PHP Debug extension, but that is no longer appearing in VS Code list of available extensions.
Any comments or suggestions gratefully received.