Docker on Linux allows Xdebug to automatically connect back to the host system so you can just set xdebug.remote_connect_back=1 and leave out the xdebug.remote_host in your xdebug.ini.

Answer from Paweł Napierała on Stack Overflow
🌐
Medium
medium.com › the-sensiolabs-tech-blog › how-to-use-xdebug-in-docker-phpstorm-76d998ef2534
How to use Xdebug in Docker & PhpStorm | The SensioLabs Tech Blog
June 14, 2022 - Before going further, there is ... as I was at the end of this article. Alright, first things first, Xdebug needs to be installed in the Docker image you use....
🌐
DEV Community
dev.to › jackmiras › xdebug-in-phpstorm-with-docker-2al8
Xdebug in PhpStorm with Docker - DEV Community
November 3, 2023 - Next, a form will open, and there, fill the Name with your Remote Debug configuration; next, check the Filter debug connection by IDE key option and then select the Server previously created; and finally, fill the IDE key (session id) with the same value that got used at the xdebug.idekey directive at our .docker/xdebug.ini. More details are in the illustration below: As a result of the previous steps, the remote debug configuration got finished, and PhpStorm can now start listening for PHP debug connections.
Discussions

phpstorm - Xdebug CLI in Docker - Stack Overflow
I read a lot of posts on GitHub and StackOverflow and I didn't find an answer. I have Docker container with PHP 7.4 and Xdebug 3. The IDE is PhpStorm. When I use Xdebug in browser, Xdebug works fin... More on stackoverflow.com
🌐 stackoverflow.com
php - Docker Compose and Xdebug not working in PhpStorm - Stack Overflow
I've tried many things trying to let work Xdebug in a Docker container. I came in contact with these resources: Setting up Xdebug with Docker Compose and WordPress image Installing XDebug in Docker More on stackoverflow.com
🌐 stackoverflow.com
Best way to use PHPStorm with WSL2

Well VSCode offers remote development: https://code.visualstudio.com/docs/remote/remote-overview

And Jetbrains followed suit: https://blog.jetbrains.com/blog/2021/11/29/introducing-remote-development-for-jetbrains-ides/

More on reddit.com
🌐 r/bashonubuntuonwindows
30
12
December 14, 2021
Using xdebug on WSL2

Please add this to xdebug.ini (with your own path, of course)
xdebug.log = "/var/www/html/xdebug.log"

More on reddit.com
🌐 r/bashonubuntuonwindows
10
6
February 9, 2021
🌐
JetBrains
jetbrains.com › help › phpstorm › configuring-xdebug.html
Configure Xdebug | PhpStorm Documentation
In this example, we're modifying /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini providing the mode and client_host Xdebug parameters. Note that the xdebug.client_host value should be replaced with the IP address of the machine where PhpStorm is running, which is accessible from the Docker ...
🌐
Devilbox
devilbox.readthedocs.io › en › latest › intermediate › configure-php-xdebug › linux › phpstorm.html
3.2.1.2. Docker on Linux: Xdebug for PhpStorm — Devilbox 1.0 documentation
# Navigate to the Devilbox git directory host> cd path/to/devilbox # Navigate to PHP 5.6 ini configuration directory host> cd cfg/php-ini-5.6/ # Create and open debug.ini file host> vi xdebug.ini
🌐
Pascallandau
pascallandau.com › blog › setup-phpstorm-with-xdebug-on-docker
How to set up PhpStorm with Xdebug on Docker [Tutorial] | pascallandau.com
Confirm the new PHP Interpreter to close the settings dialog. To verify that everything is working, open the file app/hello-world.php in PhpStorm, right click in the editor pane and choose "Run". PhpStorm will start the configured container and run the script.
🌐
GitHub
gist.github.com › chadrien › c90927ec2d160ffea9c4
Debug PHP in Docker with PHPStorm and Xdebug · GitHub
FROM php:5.6.38-apache RUN apt-get update &&\ apt-get install --no-install-recommends --assume-yes --quiet ca-certificates curl git telnet iputils-ping net-tools &&\ rm -rf /var/lib/apt/lists/* RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug \ && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" >> /usr/local/etc/php/php.ini \ && echo "xdebug.remote_port=9000" >> /usr/local/etc/php/php.ini \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini \ && echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/php.ini \ && echo "xdebug.remote_host=docker.for.mac.localhost" >> /usr/local/etc/php/php.ini \ && echo "xdebug.idekey=IDEA_DEBUG" >> /usr/local/etc/php/php.ini \ && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/php.ini \ && echo "xdebug.remote_log=/tmp/xdebug.log" >> /usr/local/etc/php/php.ini
Find elsewhere
🌐
Brunopaz
brunopaz.dev › blog › docker-phpstorm-and-xdebug-the-definitive-guide
Docker, PHPStorm and Xdebug, The definitive guide | Bruno Paz
September 6, 2018 - It will guide you to step by step through the process of installing and configuring Xdebug and PHPStorm with a Dockerized Symfony 4 application. This was tested on an Ubuntu 18.04 machine with PHPStorm 2018.1.4 and latest versions of Docker and Docker Compose.
🌐
Medium
medium.com › ekino-france › xdebug-configuration-phpstorm-docker-desktop-817da3005556
Xdebug Configuration — PhpStorm / Docker | by Arthur Gorden | ekino-france | Medium
October 18, 2024 - The mapping corresponds to the container WORKDIR of your PHP Dockerfile. You can easily check it with: ... Map the root of the project and unfold the Project Files directory so you can map the project’s index.php (or the public directory if it is the entry-point of your application). ... Don’t forget to click on “Apply” when you’re done! Open PhpStorm’s settings. "Cmd" + "," on Mac "Ctrl" + "," on Linux and Windows · Then, unfold PHP and click on Debug. In the Xdebug part, keep the 9003 port (Xdebug’s port for version 3 and more).
🌐
YouTube
youtube.com › program with gio
How To Install Xdebug 3 with Docker & PhpStorm - Full PHP 8 Tutorial - YouTube
In this lesson, we learn about debugging, what xdebug is, how to install it & set it up.SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL 👍 Smash the like bu...
Published   July 12, 2022
Views   34K
🌐
Matthew Setter
matthewsetter.com › setup-step-debugging-php-xdebug3-docker
Setup Step Debugging in PHP with Xdebug 3 and Docker Compose | Blog - Matthew Setter. Accessible Web App Developer, Educator, and Author, based in Bundaberg, Queensland.
March 10, 2021 - At this point, you need to use a supported text editor or IDE that knows how to talk to Xdebug with the open DBGp protocol. The Xdebug documentation provides a list of clients that support it. For the purposes of this guide, I'll be using PhpStorm (version 2021.1 EAP at the time of writing).
🌐
Thecodingmachine
thecodingmachine.io › configuring-xdebug-phpstorm-docker
Debugging PHP (web and cli) with Xdebug using Docker and PHPStorm
July 26, 2018 - If you are starting a project, I recommend you to download one of our images here TheCodingMachine Docker PHP images ... app: image: thecodingmachine/php:7.2-v1-apache volumes: - .:/var/www/html environment: PHP_EXTENSION_XDEBUG: 1 · Note: the PHP_EXTENSION_XDEBUG environment variable is specific to the thecodingmachine/php. It automatically configures Xdebug for the container. Keep in mind that PHPStorm opens port 9000 (by default) so Xdebug can connect to it.
🌐
DEV Community
dev.to › brpaz › docker-phpstorm-and-xdebug-the-definitive-guide-14og
Docker, PHPStorm and Xdebug, The definitive guide - DEV Community
January 2, 2020 - It will guide you to step by step through the process of installing and configuring Xdebug and PHPStorm with a Dockerized Symfony 4 application. This was tested on an Ubuntu 18.04 machine with PHPStorm 2018.1.4 and latest versions of Docker and Docker Compose.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 8626630403602-PHPStorm-doesn-t-work-with-xdebug-docker-but-is-ok-without-docker
PHPStorm doesn't work with xdebug + docker, but is ok without docker – IDEs Support (IntelliJ Platform) | JetBrains
November 17, 2022 - Are you able to make outgoing ... server or alike -- this kind of thing) Make sure that PhpStorm is the process that listen on Xdebug port (on your host OS) and not any other process (unlikely to be an issue here since the ...
🌐
Medium
medium.com › @sirajul.anik › install-and-configure-xdebug-3-in-a-docker-container-and-integrate-step-debugging-with-phpstorm-5e135bc3290a
Install and configure Xdebug 3 in a docker container and integrate step debugging with PhpStorm | by Syed Sirajul Islam Anik | Medium
August 10, 2021 - Install and configure Xdebug 3 in a docker container and integrate step debugging with PhpStorm Installation To install xdebug we can add the following line in our dockerfile. RUN pecl install …
🌐
GitHub
gist.github.com › Raistlfiren › d4286169b7223054a6b23c169ee3f182
XDEBUG 3 Configuration with Docker and PhpStorm
Name docker-cli (Same as serverName ... the server to /var/www/html · Add breakpoints file · In PhpStorm click the icon to "Start Listening for PHP Debug connections" Run in the docker file - docker-compose run php-container ...
🌐
JetBrains
blog.jetbrains.com › phpstorm › 2018 › 08 › quickstart-with-docker-in-phpstorm
Quickstart with Docker in PhpStorm | The PhpStorm Blog
... environment: XDEBUG_CONFIG: client_host=<hostname> See here for more details and possible workarounds. ... We can now start using it by creating a dedicated run/debug configuration. Run the configuration by clicking the Run button in the gutter or from the toolbar: PhpStorm will automatically download the required image and start the web server:
Published   March 5, 2024