问题
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:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_log = "C:\xampp\tmp\xdebug\xdebug.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
回答1:
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):
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.client_host = "127.0.0.1"
xdebug.log = "C:\xampp\tmp\xdebug\xdebug.log"
xdebug.idekey = VSCODE
来源:https://stackoverflow.com/questions/65137732/xdebug-v3-doesnt-stop-breakpoints-in-vscode