docker-volume-borg-backup/docker-vscode-php-xdebug/README.md

40 wiersze
1.2 KiB
Markdown

2019-07-09 14:27:13 +00:00
Debug PHP applications running on docker with vscode
====================================================
2019-09-03 12:57:25 +00:00
[Detailed tutorial here.](https://baptiste.bouchereau.pro/tutorial/debug-php-application-running-on-docker-with-vscode/)
2019-07-09 14:27:13 +00:00
Usage
-----
Run
```bash
2019-07-09 14:32:06 +00:00
git clone https://github.com/Ovski4/tutorials.git
cd docker-vscode-php-xdebug
2019-07-09 14:27:13 +00:00
```
2019-07-10 22:46:26 +00:00
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.
2019-07-09 14:27:13 +00:00
2019-07-10 22:46:26 +00:00
Then run `docker-compose up -d`.
2019-07-09 14:27:13 +00:00
2019-07-10 22:46:26 +00:00
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:
2019-07-09 14:27:13 +00:00
2019-07-10 22:46:26 +00:00
```
2019-07-09 14:27:13 +00:00
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9099,
2019-07-09 14:27:13 +00:00
"pathMappings": {
"/var/www/html/": "${workspaceRoot}"
}
}
]
}
```
2019-07-10 22:46:26 +00:00
Add a breakpoint in **index.php** and hit **Listen for XDebug**. Browse [http://localhost:8080/](http://localhost:8080/).