Laragon & XDebug- Debug PHP with VSCode on Windows

  • Modifié il y à2 semaines 
  • Temps de lecture :1Minute

A configuration that finally works ! A free alternative to PHPStorm.

Prerequisite :

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
        },
				//...
    ]
}

Laisser un commentaire