'XDebug not working in VScode for php debugging
PHP debugging in vscode using xdebug and xampp is not working even after all configurations.
here is my php.ini file config:
zend_extension = D:\Xampp\php\ext\php_xdebug-3.0.0-7.3-vc15-x86_64.dll
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
this is json file
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}"
}
]
}
Solution 1:[1]
xDebug 3 has changed several default values, so be sure your code is ready to work with new ones.
Here is my configuration set, which allowed me to use PHP breakpoints as always:
.vscode\launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
php.ini (lines manually inserted in the end of a file)
[xdebug]
zend_extension = "php_xdebug-3.0.4.dll"
xdebug.mode = debug
xdebug.discover_client_host = 1
xdebug.start_with_request = yes
xdebug.client_port = 9000
Note: above zend_extension
option would try to find your xdebug
library in a .../modules/php/PHP_%your_php_version%/ext/
folder
Solution 2:[2]
In VSCode, I went to Settings -> Features -> Debug -> Allow Breakpoints Everywhere.
I check marked "Allow Breakpoints Everywhere" and I was able to debug again.
Solution 3:[3]
I just got satisfaction with XDebug 3. I found a good response here :https://github.com/felixfbecker/vscode-php-debug/issues/411 by jason-nabooki. I do the same :
Json file :
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"stopOnEntry": true,
"log": true,
"pathMappings": {"/var/wwww/ammac":"${workspaceRoot}"}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
PHP.ini :
xdebug.mode= debug
xdebug.start_with_request = yes
xdebug.discover_client_host = true
To use the debugger (I didn't find immediatly due to my precedent use of Eclipse !),
first : click on the green triangle near "Listen for XDebug
second : refresh the web page in Firefox (or other)
For me it works i got the variables. Not yet test the breakpoints.
Remark : no need of the XDEbug helper in Firefox (surprise!)
Solution 4:[4]
Struggled with this myself. Apparently XDebug 3.x doesn't work as outlined above. I found that even the equates under [XDebug] are no longer compatible. Download XDebug 2.x (I think 2.98 is the latest in the 2.x series). After I switched to 2.x, I'm no longer having any issue (so far).
Solution 5:[5]
https://xdebug.org/wizard - This tool helped me to find the reason why debuger didn't work.
Solution 6:[6]
Your are using xdebug version 3:
zend_extension = ... php_xdebug-3....
but in configuration you listen port 9000:
"port": 9000
The default Xdebug port changed between Xdebug v2 to v3 from 9000 to 9003.
Just change "port": 9000 => "port": 9003
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Roman Penyaz |
Solution 2 | Garrett |
Solution 3 | AC24 |
Solution 4 | Michael K Vrazel |
Solution 5 | Igor Semkiv |
Solution 6 | ??????? ??????? |