I am trying to debug on my XAMPP using VSCode and didn’t worked. I know there are tons of questions about this and I’ve tried everything I can but still won’t work.
There is really 1 thing weird thou about my xdebug extension.I am currently using PHP v7.4.12 and Xdebug version 3.
I know my Xdebug works on PHP because I viewed phpinfo()
and it shows just how I set it. The weird part is among the many of the tutorials out there normally zend_extension = path..
,xdebug.remote_enable = 1
and xdebug.remote_autostart = 1
should be enough but when I viewed phpinfo it is as follows below:
I tried to set it with xdebug.remote_port = 9000
and xdebug.remote_host = "localhost"
but still won’t work. I even have read about changing localhost to 127.0.0.1
but still didn’t work.
Any help would be appreciated. Here is my launch.json file and php ini file.
php.ini
zend_extension = "C:xamppphpextphp_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_log = "C:xampptmpxdebugxdebug.log"
xdebug.remote_port = 9000
xdebug.remote_host = "127.0.0.1"
xdebug.idekey=VSCODE
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch current script in console",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"externalConsole": false,
"port": 9000
},
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000
}
]
}
If it is caused maybe due to not setting "pathMappings", anyone can teach me how to use this?
By the way the xdebug.log also doesn’t work
2
Answers
You are using Xdebug v3 but keep using Xdebug v2 config parameters. You need to go through Upgrading from Xdebug 2 to 3 Guide and adjust your settings.
Xdebug v3 uses different config params than Xdebug v2 (your
phpinfo()
output tells you exactly that on your screenshot). 5 out of 6 "xdebug." params from your current php.ini do nothing in Xdebug v3.For Xdebug 3 it should be like this (based on your original config — better start using new 9003 default port):
OS: Windows 10
VS Code marks the breakpoints as "unverified breakpoint".
In my case, i had to add "pathMappings":
Sidenote when you are working with docker: The remote path is the path inside the docker container.