J
J
johnmohnachev2017-03-26 09:06:33
PHP
johnmohnachev, 2017-03-26 09:06:33

How to set up Debug mode if the sources are in Docker?

Already in despair, yesterday I sat all day, today for a couple of hours, I'm marking time, I've climbed a bunch of forums, but I can't stand on the break.
This is how my compose file looks like:

version: "2"
services:
  db:
    image: mysql:5.6
    environment:
      MYSQL_ROOT_PASSWORD: "***"
      MYSQL_DATABASE: "***"
    ports:
      - "3306:3306"
  web:
    image: webdevops/php-nginx-dev:ubuntu-15.10
    expose:
      - "9000"
      - "9001"
    ports:
      - "8080:80"
      - "8443:443"
    links:
      - db
    volumes:
      - /Users/evgeny/Projects/php_docker_test/:/app

This is what the xdebug settings look like:
xdebug.remote_host=dockerhost
xdebug.idekey=PHPSTORM
xdebug.remote_port=9001
xdebug.remote_connect_back=0
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.profiler_enable=0
xdebug.remote_handler=dbgp
xdebug.remote_mode=req

This is how the settings in IDEA look like:
gMifLP7s8T9JgHr4XFvNvwsM8xnQpe.png
This is how I run Debug
JXIyZ7tohB7GMeXCxJJdRngQVx9zha.png
But I can't get up, please help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Konyukhov, 2017-03-26
@piromanlynx

From the config in my mind I can see badly what's wrong .... I can advise how to debug:
1. Check in all the right directions using telnet - does the connection open.
2. "php5-fpm -i" and "php5-fpm -m" inside docker (if fpm is there) to see if xdebug and settings really cling. Well, either phpinfo();...
3. look at netstat -ant inside the docker and outside - to understand what is happening with the connection, whether it opens and where it is lost
4. in extreme cases, tcpdump on the host
and here ( https:// xdebug.org/docs/all_settings ) is about xdebug.remote_connect_back , maybe it will give you ideas. And in my opinion, the docker had ready-made images with fpm and configured xdebug under phpstorm

T
Tyranron, 2017-03-26
@Tyranron

You have a port specified in your Xdebug config 9001.
And in the container, this port is exposed through the expose.

expose:
      - "9000"
      - "9001"

PHPStorm is docker-compose.ymlnot visible, which means it cannot see Xdebug on the port you feed it.
What should be done?
1. Move the port 9001to ports:.
2. In the IDEA settings, specify Host: localhostfor Xdebug (now you have some kind of left IP there).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question