Flight Deck may be configured to support Xdebug, an open source PHP debugger. Using a debugger makes a world of difference if you’ve been using
Xdebug is enabled out of the box in Flight Deck. If you need to disable or re-enable it, you only need to edit the
docker-composecommands, kill your currently running instance of Flight Deck.
.envfile in your favorite text editor.
.envfile for details.
docker-compose up -d.
To verify that Xdebug is working, you will need to visit a page displaying
phpinfo(). If using Flight Deck with Drupal, you can do the following:
xdebugmodule is loaded in the page output.
Xdebug uses an “IDE key” to identify if you are attempting to debug a page. To make setting this parameter easier, you can install a web browser extension:
By default, Flight Deck expects the IDE key to be
PHPSTORM. Be sure to set it in the extension preferences.
Even though Flight Deck is running on your local machine, you need to treat it as if it was a completely separate, physical machine elsewhere on the network. For this reason, you need to configure PHPStorm to map file paths on your local machine to those inside the containers.
First we need to create a new Debug configuration. You only have to do that once per project.
Next, we need to configure the remote server.
srcdirectory. Enter the Absolute path on the server as
Linux hosts have two ways they may configure Xdebug support.
.envisn’t shared between multiple, mixed-OS team members, follow the instructions to use
.envis shared, you can define a loopback alias (see the
.envfile for an example). Once finished, continue to the next section.
In order for PHPStorm to pick up the remote debugging session, you need to configure the DBGp Proxy:
By default, Flight Deck stores Xdebug logs at
/var/log/apache2/xdebug.log. If you ever need to troubleshoot the Xdebug configuration is may be useful to redirect the logs to STDOUT, this makes the logs available with a
docker-compose logs command.
To enable Xdebug logging to STDOUT:
.envfile for editing.
PHP_XDEBUG_STDOUT_LOGSsetting, be sure it’s set to a value of
docker-compose logsto view the container logs.
When interacting with the web container using
docker-compose exec, you may see the output of Xdebug in your terminal window. This is normal, if annoying, when
PHP_XDEBUG_STDOUT_LOGS is enabled.
You may wish to set up an alias for setting the loopback address. This command differs slightly on macOS and Linux:
# For macOS alias docdebug='sudo ifconfig lo0 alias 10.254.254.254' # For Linux alias docdebug='sudo ip -4 addr add 10.254.254.254/32 dev lo'