Xdebug with VS Code (Remote - SSH)

quickly setup php debugging on remote server with Xdebug and VS Code with Remote-SSH enable

Xdebug with VS Code (Remote - SSH)

Verions

Ubuntu 20.04
Xdebug 3.04
php 7.4


Install Xdebug on Remote Server

Installation Wizard

Notice at the end of the instruction, it points out the config file for Xdebug:
Where these sections refer to php.ini or similar, please remember to use /etc/php/7.4/apache2/conf.d/20-xdebug.ini

/etc/php/7.4/apache2/php.ini &
/etc/php/7.4/apache2/conf.d/20-xdebug.ini

zend_extension = xdebug

Step Debugging

/etc/php/7.4/apache2/conf.d/20-xdebug.ini

zend_extension = xdebug
xdebug.mode = debug
xdebug.start_with_request = yes

VS Code

.vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "port": 9003,
    }
  ]
}