Skip to content

Commit 673bb95

Browse files
authored
Merge pull request #2457 from tarlepp/feat-xdebug-configuration
Feat - Better Xdebug configuration
2 parents b03778f + 1f3a627 commit 673bb95

File tree

4 files changed

+5
-39
lines changed

4 files changed

+5
-39
lines changed

doc/XDEBUG.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ have all basic configuration ready.
1515
* [PhpStorm basic configuration](#phpstorm-basic-configuration-table-of-contents)
1616
* [First connection](#first-connection-table-of-contents)
1717
* [Configuring debugging server](#configuring-debugging-server-table-of-contents)
18-
* [Mac users](#mac-users-table-of-contents)
1918
* [Debug CLI commands](#debug-cli-commands-table-of-contents)
2019
* [Debug Postman requests](#debug-postman-requests-table-of-contents)
2120
* [External links / resources](#external-links--resources-table-of-contents)
@@ -27,9 +26,6 @@ These instructions relies heavily to screenshots, so you might need to use
2726
your own brains for some parts of these instructions - but I bet you can get
2827
this working in couple of minutes.
2928

30-
Note that if you're using Mac, read [Mac users](#mac-users-table-of-contents)
31-
section first.
32-
3329
### PhpStorm basic configuration [](#table-of-contents)
3430

3531
1) Make sure that Xdebug port is `9003`
@@ -71,25 +67,6 @@ local paths. See the image below:
7167

7268
![Path mappings](images/xdebug_05.png)
7369

74-
## Mac users [](#table-of-contents)
75-
76-
Mac users need to create a `docker-compose.override.yml` file with following
77-
content:
78-
79-
```yaml
80-
version: '3'
81-
services:
82-
php:
83-
environment:
84-
- DOCKER_WITH_MAC=1
85-
```
86-
87-
And if you're reading this you might want to read [Speed problems with docker-compose?](SPEED_UP_DOCKER_COMPOSE.md)
88-
document, which will tell you how to speed your Mac environment quite lot.
89-
90-
You just need to combine those both configurations to your local
91-
`docker-compose.override.yml` file
92-
9370
## Debug CLI commands [](#table-of-contents)
9471

9572
By default this application assumes that you're using `app.localhost` as your

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ services:
1919
- /app/var/:uid=$HOST_UID,gid=$HOST_GID
2020
environment:
2121
PHP_IDE_CONFIG: "serverName=app.localhost"
22+
extra_hosts:
23+
- "host.docker.internal:host-gateway"
2224

2325
nginx:
2426
container_name: symfony-backend-nginx

docker-entrypoint-dev.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ set -e
44
#
55
# If we're starting web-server we need to do following:
66
# 0) Basic linting of current JSON configuration file
7-
# 1) Determine docker container IP address, so that we can use it within
8-
# XDebug configuration. Copy php.ini file to correct location and modify
9-
# it to contain correct remote host value. With this we don't need to
10-
# build container each time we want to change something in php.ini file.
11-
# Also we want to export host IP so that we can use that within
12-
# `check.php` to check that current environment is compatible with Symfony
7+
# 1) Copy updated php configuration file, with this we can change php
8+
# configuration without rebuilding image
139
# 2) Install all dependencies
1410
# 3) Generate JWT encryption keys
1511
# 4) Create database if it not exists yet
@@ -21,16 +17,7 @@ set -e
2117
make lint-configuration
2218

2319
# Step 1
24-
if [[ -z "${DOCKER_WITH_MAC}" ]]; then
25-
# Not Mac, so determine actual docker container IP address
26-
HOST=$(/sbin/ip route|awk '/default/ { print $3 }')
27-
else
28-
# Otherwise use special value, which works with Mac
29-
HOST="docker.for.mac.localhost"
30-
fi
31-
3220
cp /app/docker/php/php-dev.ini /usr/local/etc/php/php.ini
33-
sed -i "s/xdebug\.client_host \=.*/xdebug\.client_host\ = $HOST/g" /usr/local/etc/php/php.ini
3421

3522
DOCKER_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
3623

docker/php/php-dev.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ apc.serializer=igbinary
3030
; Xdebug settings
3131
xdebug.mode = coverage,debug
3232
xdebug.start_with_request = yes
33-
xdebug.client_host = 127.0.0.1
33+
xdebug.client_host = host.docker.internal

0 commit comments

Comments
 (0)