The following assumes that you are using ApiOpenStudio Docker Dev.
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
If this is the first time that xDebug has been set up in your PHPStorm, you need to set up the PHP interpreters.
Ensure that your docker instance is running, so that PHPStorm can detect the apiopenstudio-php
container.
Click on Preferences -> PHP.
Select the PHP language level
- this should be the same as the PHP version in your docker setup.
In the CLI interpreter, click on the ...
.
In the CLI Interpreters
modal that pops up, click on the +
to add a new interpreter and select From Docker, Vagrant, VM, WSL, Remote...
.
In the new popup:
Docker
.apiopenstudio_docker_dev_php
.PHP interpreter path
as php
.Apply
and OK
.In PhpStorm, go to PhpStorm -> Preferences -> PHP -> Debug.
This is how PHPStorm will map the local file paths to the ones in your container.
Go to File
-> Settings
-> PHP
-> Servers
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.
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 path mapping will be /var/www/html/admin
.