Answer the question
In order to leave comments, you need to log in
Why don't breakpoints work in xdebug + phpstorm + docker?
Good day to all! Trying to set up xdebug in phpstorm using docker.
I have nginx on which there are several virtual hosts, below is the docker-compose.yml code, snippet php-fpm Dockerfile and xdebug.ini
version: '3.1'
volumes:
esdata01:
driver: local
esdata02:
driver: local
networks:
esnet:
frontend:
backend:
internal:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.220.0/28
services:
nginx:
image: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./hosts:/etc/nginx/conf.d
- ./www:/var/www
- ./logs:/var/log/nginx
links:
- php
networks:
- internal
mysql:
image: mysql:5.7
ports:
- "3306:3306"
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: secret
networks:
- internal
# postgres:
# image: postgres
# ports:
# - "3306:3306"
# environment:
# MYSQL_ROOT_PASSWORD: secret
adminer:
image: adminer
restart: always
ports:
- 8080:8080
networks:
- esnet
php:
build: ./images/php
links:
- mysql
volumes:
- ./www:/var/www
networks:
- internal
extra_hosts:
- "dockerhost:10.0.75.1"
environment:
XDEBUG_CONFIG: "remote_host=dockerhost remote_enable=1 idekey=PHPSTORM"
PHP_IDE_CONFIG: "serverName=Docker"
workspace:
build: ./images/workspace
volumes:
- ./www:/var/www:cached
extra_hosts:
- "dockerhost:10.0.75.1"
ports:
- "2222:22"
tty: true
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: elasticsearch
environment:
- node.name=elasticsearch
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=elasticsearch
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- esnet
# es02:
# image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
# container_name: es02
# environment:
# - node.name=es02
# - discovery.seed_hosts=es01
# - cluster.initial_master_nodes=es01,es02
# - cluster.name=docker-cluster
# - bootstrap.memory_lock=true
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
# ulimits:
# memlock:
# soft: -1
# hard: -1
# volumes:
# - esdata02:/usr/share/elasticsearch/data
# networks:
# - esnet
redis:
image: redis:latest
volumes:
- ./www/redis:/data
ports:
- "6379:6379"
networks:
- esnet
ADD ./php.ini /usr/local/etc/php/php.ini
ADD ./xdebug.ini /usr/local/etc/php/xdebug.ini
xdebug.remote_host=dockerhost
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.cli_color=0
xdebug.profiler_enable=0
xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling"
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=-1
Answer the question
In order to leave comments, you need to log in
xdebug.idekey = "PHPSTORM"
xdebug.default_enable = 1
xdebug.remote_enable = 1
xdebug.remote_host = host.docker.internal
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question