docker-volume-borg-backup/docker-vscode-php-xdebug
Baptiste Bouchereau c551446301 Use latest image versions 2020-11-13 11:41:14 +01:00
..
.vscode Update the xdebug listening port so we don't mistake it with the PHP one 2020-03-23 15:19:44 +01:00
Dockerfile-php-app Use latest image versions 2020-11-13 11:41:14 +01:00
README.md Update the xdebug listening port so we don't mistake it with the PHP one 2020-03-23 15:19:44 +01:00
app.conf First tutorials 2019-07-09 16:27:13 +02:00
docker-compose.yml Use latest image versions 2020-11-13 11:41:14 +01:00
index.php First tutorials 2019-07-09 16:27:13 +02:00
php.ini Update the xdebug listening port so we don't mistake it with the PHP one 2020-03-23 15:19:44 +01:00

README.md

Debug PHP applications running on docker with vscode

Detailed tutorial here.

Usage

Run

git clone https://github.com/Ovski4/tutorials.git
cd docker-vscode-php-xdebug

Edit the php.ini with your internal host ip. On a ubuntu laptop, running hostname -I | awk '{print $1}' on the command line prints it.

Then run docker-compose up -d.

In vscode install the PHP Debug extension by Felix Becker. Then select the debug tab, then click Add Configuration.. and select the PHP environment. This will open the launch.json file. Erase its content with the following:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9099,
            "pathMappings": {
                "/var/www/html/": "${workspaceRoot}"
            }
        }
    ]
}

Add a breakpoint in index.php and hit Listen for XDebug. Browse http://localhost:8080/.