How to set up a dev environement with nextcloud debugging based on

Dev workstation side (windows10) Get Visual Studio Code (1.34.0) and its extension “PHP Debug” (1.13.0)

Server side (WSL Debian 9)

php-fpm 7.0 installed with

gui@SAGIS-09:$ sudo apt-get install php7.0-fpm

activate notice logs :

gui@SAGIS-09:$ sudo vi /etc/php/7.0/fpm/php-fpm.conf

error_log = /var/log/php7.0-fpm.log log_level = notice

and dev tools

gui@SAGIS-09:$ sudo apt-get install php7.0-dev

clone the Xdebug source , and build it

gui@SAGIS-09:/usr/src/$ sudo git clone 
gui@SAGIS-09:/usr/src/$ cd xdebug/
gui@SAGIS-09:/usr/src/$ sudo ./ 
gui@SAGIS-09:/usr/src/$ sudo make install

You will have the library inside a directory

Configure php-fpm to get xdebug listening on server side

gui@SAGIS-09:/$ sudo vi /etc/php/7.0/fpm/php.ini

add config at the end / 9009 is used because nginx/apache httpserver could use the default port 9000 with fpm


Dev workstation side (windows10) Open the configurations on DEBUG / PHP (the launch.json file)

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit:
    "version": "0.2.0",
    "configurations": [
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9009,
            // server -> local
                "/var/www/html": "${workspaceRoot}/www",
//                "/app": "${workspaceRoot}/app",
                "/home/gui/nc": "${workspaceRoot}",
                "/apps": "${workspaceRoot}/apps",
                "/custom_apps": "${workspaceRoot}/custom_apps"                
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9009