B
B
blantcat2018-07-31 01:07:07
PHP
blantcat, 2018-07-31 01:07:07

How to setup phpstorm + xdebug + docker?

Tell me, please, what is the error? xdebug doesn't stop at breakpoints, it doesn't see them at all.
Dockerfile

FROM php:7.1-apache

RUN apt-get update &&\
    apt-get install --no-install-recommends --assume-yes --quiet ca-certificates curl git &&\
    rm -rf /var/lib/apt/lists/*

RUN pecl install xdebug && docker-php-ext-enable xdebug

COPY php.ini /usr/local/etc/php/

docker-compose.yml
version: "3.6"
services:
  app:
    build: ./.docker
    ports:
      - "80:80"
    volumes:
      - ./src:/var/www/html

php.ini
[xdebug]
zend_extension=xdebug.so
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey=docker
xdebug.remote_host=172.18.0.2

phpstorm
5b5f89b9ee352349376123.png5b5f8a35d037e613941848.png5b5f8ab1cf636495442496.png5b5f8b3dd5c75915298664.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-07-31
@xpert13

Works for me with these settings:

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.cli_color=0
xdebug.profiler_enable=0
xdebug.remote_handler=dbgp
xdebug.remote_mode=req

xdebug.remote_port=9000
xdebug.remote_host=host.docker.internal
xdebug.idekey=PHPSTORM

Run via PhpStorm -> Run -> Start Listening for PHP Debug Connections .
Launch options via Run->Debug did not work for me when working with docker.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question