Skip to content

Instantly share code, notes, and snippets.

@NAbdulla1
Last active August 13, 2021 06:11
Show Gist options
  • Save NAbdulla1/d60730f4a7d01fef8c814dbd02b121d9 to your computer and use it in GitHub Desktop.
Save NAbdulla1/d60730f4a7d01fef8c814dbd02b121d9 to your computer and use it in GitHub Desktop.
Setup wsl2 and vscode on windows to use xdebug as php debugger. vscode will connect to wsl2 via remote connection. the xdebug.ini file is located at `/etc/php/7.4/mods-available/xdebug.ini`. (7.4 is php version. it can differ, and the tested xdebug version is 2.9.2). the `launch.json` must be in `.vscode` folder of the project in the project root
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000,
"ignore": [
"**/vendor/**/*.php"
],
"hostname": "0.0.0.0",
"args": [
"-dxdebug.remote_host=wsl2.host"
],
}
]
}
zend_extension="/usr/lib/php/20190902/xdebug.so" #find the xdebug.so file path and replace this
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_log=/tmp/xdebug.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment