Debugging Setup in Docker

Edit on GitHub

Running Spryker containers with Xdebug enabled

Run containers:

docker/sdk up -x
If containers are already running, the fastest option is to run `docker/sdk run -x`.

Configuring Xdebug in PhpStorm

Required Configuration

Xdebug configuration

Open PreferencesLanguages & FrameworksPHPDebug in PhpStorm and do the following:

  1. 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

Open PreferencesLanguages & FrameworksPHPServers in PhpStorm and do the following:

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

Optional Configuration

Remote PHP interpreter Setup
  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
  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 use 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