Skip to content

Debugging Drupal Code

Add a PHP Server

First, you have to set up a Drupal environment with the tool l3d. The tool is based on Docker containers.

Now navigate to File->Settings in your IDE and create a server:

Screenshot

Set the following values:

Screenshot

Important: Always use Docker as name of your server.

Do not forget to add the file mapping to /var/www/html.

Add a new Run/Debug Configuration

Screenshot

First create a new PHP Web Page configuration:

Screenshot

Set the following values:

Screenshot

Select the server you just have created.

Important: Always use Docker as name of your configuration.

Start Debugging

First, check the debug settings in your IDE. It should look something like this:

Screenshot

Now activate the Phone icon in your IDE:

Screenshot

Now you can set your breakpoints and enjoy debugging Drupal code.