skip to Main Content

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:

enter image description here

Also set DBGp proxy like

enter image description here

Also created a server:

enter image description here

This is my etc/hosts:
and I call API in Postman with the following address: api.vendet.local/api/v1/test

UPDATED path mapping:
enter image description here

Still not break in any point. What is the problem and how can I do that?

2

Answers


  1. Be aware that as long as you are not using network_mode: "host" for the php container localhost / 127.0.0.1 for Xdebug running within the container is not the same as localhost on your Ubuntu host!

    To be able to connect to Xdebug from PHPStorm you need to ensure the following:

    • the debugger is listening on an IP reachable from the host: listening on 127.0.0.1 it would only be accessible from within the container itself. Connecting to 127.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 specify 0.0.0.0 as address
    • path mappings are enabled – since (most probably) the paths of the PHP files within the container are not identical with the paths to the same files on the host.
    Login or Signup to reply.
  2. I’ve checked in container itself and 9000 port is listening

    It 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search