6.14. Configure Xdebug in PhpStorm

The following assumes that you are using apiopenstudio_docker_dev.

6.14.1. Enable Xdebug in docker

The dockerfile is configured toi create a build from php:n.n-fpm, and you can enable the build to include the xDebug packages using a simple environment variable,

Turn on Xdebug in .env in your checkout of apiopenstudio_docker_dev:

WITH_XDEBUG=true

Rebuild your docker containers

docker-compose build

Or

docker-compose up -d --build

6.14.2. PHPStorm configurations

6.14.2.1. Set the port

In PhpStorm, go to PhpStorm -> Preferences -> PHP -> Debug.

Set xDebug port

6.14.2.2. Configure a server.

This is how PHPStorm will map the local file paths to the ones in your container.

Go to File -> Settings -> PHP -> Servers

Configure the xDebug server

Give a name to the server. It should be a recognisable name, so you can identify it later, i.e. "apiopenstudio".

Ensure you have "Use path mappings" checked, and edit the RHS to /var/www/html/api.

Click "Apply" to save your configurations.

6.14.3. Configuring Xdebug for ApiOpenStudio Admin

Depending on how you have set up your projects, and you have admin in a separate project, you will also need to set up servers as above, for your admin project.

The remote paty mapping will be /var/www/html/admin.

6.14.4. Links