Xdebug does not work in PhpStorm when I run Drupal site on Docksal

I need Xdebug to keep track of incoming data, where it goes, etc.
Since I run(raise up) the Drupal site using docksal, I set it up according to the instructions Xdebug :: Docksal Documentation

  1. I wrote the command:

    fin config set --env=local XDEBUG_ENABLED=1

And in the file docksal-local.env changed to:


  1. I wrote the command:

    fin project start

  2. I checked xdebug:

    fin exec php-v | grep -i xdebug

And received:

with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans

  1. In the index.php file, I put a breakpoint on some line

  2. I clicked the Start Listening for PHP Debug Connections button

  3. I went to the site page in the browser, updated it and returned to PhpStorm

But nothing happened. What do I need to do to make Xdebug work?

how did you configure Xdebug?

This is my configuration in the Dockerfile:

RUN echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
 && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
 && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini \
 && echo "xdebug.remote_connect_back=off" >> /usr/local/etc/php/conf.d/xdebug.ini \
 && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/xdebug.ini \
 && echo "xdebug.remote_port=9003" >> /usr/local/etc/php/conf.d/xdebug.ini \
 && echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/xdebug.ini \
 && echo "xdebug.max_nesting_level=1500" >> /usr/local/etc/php/conf.d/xdebug.ini

I used it on Mac, this is why I used host.docker.internal as remote host. You need to set it to a valid IP on the host which is accessible from the container.

This is my xdebug configuration in PHPStorm (I used Port 9000 and 9003 for compatibility reasons)