Configuring debugging in Docker

Edit on GitHub

This document provides information about setting up the debugging for Spryker in Docker.

Xdebug is used to debug setup in Docker. To enable Xdebug, run the command:

docker/sdk {run|start|up} -x

Configuring Xdebug in PhpStorm - Required Configuration

This section describes the required configuration for Xdebug in PHPStorm.

Xdebug configuration

Follow the steps to configure Xdebug in PHPstorm:

  1. Open PreferencesLanguages & FrameworksPHPDebug.

  2. In the Xdebug block:

    a. Depending on your requirements, change the Debug port value. It is set to “9000” by default. b. If not selected, select the Can accept external connections checkbox. c. If selected, clear the Force break at first line when no path mapping specified and Force break at first line when a script is outside the project checkboxes.

image

  1. In the External connections block:

    a. Increase Max. simultaneous connection from 4 to 5. b. If selected, unselect the Ignore external connections through unregistered server configurations and Break at first line in PHP scripts checkboxes.

image 2

Servers configuration

Follow the steps to configure servers:

  1. Open PHPStorm → PreferencesLanguages & FrameworksPHPServers.

  2. Add a server:

    1. In the Name field, enter spryker.
    2. In the Host section, enter spryker.
    3. Select the Use path mappings checkbox.
    4. Set the absolute path to the /data folder on the server for the folder with your Spryker project files. Servers config

Configuring Xdebug in PhpStorm - Optional Configuration

This section describes the optional configuration for Xdebug in PHPStorm.

Remote PHP Interpreter Setup

Follw the steps to add a PHP interpreter:

  1. Open PreferencesLanguages & FrameworksPHP.
  2. Add new remote PHP interpreter: a. Server: “Docker” b. Image name: “spryker_app:latest” c. PHP interpreter path: php

Remote php interpreter

Remote Debug configuration

Follow the steps to add a PHP Remote Debug configuration:

  1. Open RunEdit Configurations…. Edit configurations

  2. Add new PHP Remote Debug configuration. PHP remote debug

  3. Set the name to “spryker”.

  4. Select the spryker server.

  5. Set the PHPSTORM IDE key.

Debugging with Xdebug

To debug an application, do the following:

  1. Make a breakpoint: Breakpoint

  2. Click Start listening

  3. Open the application in browser.

  4. Navigate to the action for which you configured the breakpoint in step 1. The debugging process should be running in the IDE: Debug process