A configuration that finally works ! A free alternative to PHPStorm.
Prerequisite :
- Visual Studio Code
- PHP Extension Pack VSCode Extension
- Laragon
- PHP v7.4.33-Win32-vc15-x64
- XDebug v3.1.6-7.4-vc15-x86_64
- XDebug helper chrome extension
Chrome Extension : XDebug helper
Install XDebug helper Chrome extension and enable the Debug mode.
XDebug
Download and copy the xdebug-3.1.6-7.4-vc15-x86_64.dll in the PHP ext
folder.
C:\laragon\bin\php\php-7.4.33-Win32-vc15-x64\ext\
Verify XDebug is properly installed by follow the instructions at : https://xdebug.org/wizard
Laragon
This line is added automatically by Laragon when activating the extension by clicking it :
Laragon > Menu > PHP > Extensions > xdebug-3.1.6-7.4-vc15-x86_64
zend_extension=xdebug-3.1.6-7.4-vc15-x86_64
; Manually added
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host=localhost
xdebug.idekey = VSCODE
xdebug.port=9003
xdebug.mode=debug
VSCode
VSCode > Run and Debug > Modify/Add the “Listen for Xdebug” configuration.
{
// ...
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
//...
]
}