Recently I’ve started to work on a new project that is dockerized and has Xdebug module. Also I’ve checked in container itself and 9000 port is listening and has Xdebug module version 2.9.8
I don’t have any PHP or anything installed on my Ubuntu (host system).
In my PhpStorm I set my PHP interpreter manually:
Also set DBGp proxy like
Also created a server:
This is my etc/hosts:
and I call API in Postman with the following address: api.vendet.local/api/v1/test
Still not break in any point. What is the problem and how can I do that?
2
Answers
Be aware that as long as you are not using
network_mode: "host"
for thephp
containerlocalhost
/127.0.0.1
for Xdebug running within the container is not the same aslocalhost
on your Ubuntu host!To be able to connect to Xdebug from PHPStorm you need to ensure the following:
127.0.0.1
it would only be accessible from within the container itself. Connecting to127.0.0.1:9000
on the host will be forwarded to the container, but to the virtual network interface of the container and not to the loopback device. To simply listen on all devices within the container specify0.0.0.0
as addressIt is IDE that should be listening on port 9000, not the container.
#1: you don’t need to use DBGp proxy.
#2: at PHP | Servers you have to enable "Use path mappings".
If I were you, I would delete all the configuration you made in PhpStorm (#1 & #2) and would start from the scratch.
First: make sure to configure XDebug properly in a container, see Configure Xdebug running in a Docker container. Pay attention to the value of
xdebug.client_host
described in the article.Then: just run a simple Zero-configuration debugging