Skip to content

EWPP-721: Update xdebug configuration. #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ To run the phpunit tests:
docker-compose exec web ./vendor/bin/phpunit
```

#### Step debugging

To enable step debugging from the command line, pass the `XDEBUG_SESSION` environment variable with any value to
the container:

```bash
docker-compose exec -e XDEBUG_SESSION=1 web <your command>
```

Please note that, starting from XDebug 3, a connection error message will be outputted in the console if the variable is
set but your client is not listening for debugging connections. The error message will cause false negatives for PHPUnit
tests.

To initiate step debugging from the browser, set the correct cookie using a browser extension or a bookmarklet
like the ones generated at https://www.jetbrains.com/phpstorm/marklets/.

## Configuration

Task Runner commands can be customized in two ways:
Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ services:
- .:/var/www/html # Non Mac users.
# - nfsmount:/var/www/html # Mac Users with the nfsmount volume.
environment:
XDEBUG_CONFIG: "remote_enable=1 remote_host=10.254.254.254 remote_port=9000 idekey=PHPSTORM remote_autostart=1"
XDEBUG_CONFIG: "client_host=172.17.0.1" # Non-Mac users.
# XDEBUG_CONFIG: "client_host=host.docker.internal" # Mac users.
XDEBUG_MODE: "develop, debug"
Comment on lines -12 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

PHP_IDE_CONFIG: "serverName=Docker"
# For Xdebug setup, run this command in the terminal:
# For Mac users: sudo ifconfig en0 alias 10.254.254.254 255.255.255.0
# For Linux users: sudo ip addr add 10.254.254.254/32 dev lo label lo:1
# Enable step debugging for all PHP request. See ./README.md#step-debugging for more information.
# XDEBUG_SESSION: 1

#### Mac users: uncomment the "volumes" key to enable the NFS file sharing. You can find more information about Docker for Mac here: https://github.com/openeuropa/openeuropa/blob/master/docs/starting/tooling.md#using-docker-on-macos

Expand Down