docker4drupal
docker4drupal copied to clipboard
Making xdebug work with PhpStorm
Codebase Mounted codebase
Describe your issue I've followed the documentation to enable xdebug on my stack with PhpStorm but it didn't work. Tried every possible configuration ; could you please help?
General information
- OS: Windows 10
- Docker version: 2.5.0.0
- Docker engine: 19.03.13
- PHP: 8.0.13
- Xdebug version: 3.1.0
- PhpStorm version: 2019.3.4
I have do the following:
- Uncommented docker-compose variables:
PHP_XDEBUG: 1
PHP_XDEBUG_MODE: debug
PHP_IDE_CONFIG: serverName=my-ide
PHP_XDEBUG_IDEKEY: "my-ide"
PHP_XDEBUG_CLIENT_HOST: host.docker.internal
PHP_XDEBUG_LOG: /tmp/php-xdebug.log
IDE configuration
General xdebug settings:
Debug server and mapping:
Added breakpoint:
Enabled PhpStorm listener:
Even Chrome extension:
Output of docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
scan: Docker Scan (Docker Inc., v0.9.0)
Server:
Containers: 16
Running: 6
Paused: 0
Stopped: 10
Images: 40
Server Version: 19.03.13
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8fba4e9a7d01810a393d5g6gz6z621dc101981175
runc version: dc9208a3303feef5338hf4323d9beb36df0a9dd
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 5.4.39-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.923GiB
Name: docker-desktop
ID: 2F2C:2GX2:GCHZ:OJUU:EF3D:LNMH:BYN7:45KG:DUYP:76QH:4JN3:H3CO
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Contents of your docker-compose.yml
version: "3.7"
services:
mariadb:
image: wodby/mariadb:$MARIADB_TAG
container_name: "${PROJECT_NAME}_mariadb"
stop_grace_period: 30s
environment:
MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
MYSQL_DATABASE: $DB_NAME
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
php:
image: wodby/drupal-php:$PHP_TAG
container_name: "${PROJECT_NAME}_php"
environment:
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
PHP_XDEBUG: 1
PHP_XDEBUG_MODE: debug
PHP_IDE_CONFIG: serverName=my-ide
PHP_XDEBUG_IDEKEY: "my-ide"
PHP_XDEBUG_CLIENT_HOST: host.docker.internal # Docker 18.03+ Mac/Win
PHP_XDEBUG_LOG: /tmp/php-xdebug.log
volumes:
- ./:/var/www/html:cached
crond:
image: wodby/drupal-php:$PHP_TAG
container_name: "${PROJECT_NAME}_crond"
environment:
CRONTAB: "0 * * * * drush -r /var/www/html/web cron"
command: sudo -E LD_PRELOAD=/usr/lib/preloadable_libiconv.so crond -f -d 0
volumes:
- ./:/var/www/html:cached
nginx:
image: wodby/nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
depends_on:
- php
environment:
NGINX_STATIC_OPEN_FILE_CACHE: "off"
NGINX_ERROR_LOG_LEVEL: debug
NGINX_BACKEND_HOST: php
NGINX_SERVER_ROOT: /var/www/html/web
NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
volumes:
- ./:/var/www/html:cached
labels:
- "traefik.http.routers.${PROJECT_NAME}_nginx.rule=Host(`${PROJECT_BASE_URL}`)"
mailhog:
image: mailhog/mailhog
container_name: "${PROJECT_NAME}_mailhog"
labels:
- "traefik.http.services.${PROJECT_NAME}_mailhog.loadbalancer.server.port=8025"
- "traefik.http.routers.${PROJECT_NAME}_mailhog.rule=Host(`mailhog.${PROJECT_BASE_URL}`)"
traefik:
image: traefik:v2.0
container_name: "${PROJECT_NAME}_traefik"
command: --api.insecure=true --providers.docker
ports:
- '8000:80'
# - '8080:8080' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Contents of your .env
### Documentation available at https://wodby.com/docs/stacks/drupal/local
### Changelog can be found at https://github.com/wodby/docker4drupal/releases
### Images tags format explained at https://github.com/wodby/docker4drupal#images-tags
### PROJECT SETTINGS
PROJECT_NAME=portal
PROJECT_BASE_URL=portal.localhost
DB_NAME=drupal
DB_USER=drupal
DB_PASSWORD=drupal
DB_ROOT_PASSWORD=password
DB_HOST=mariadb
DB_PORT=3306
DB_DRIVER=mysql
### --- MARIADB ----
MARIADB_TAG=10.6-3.15.0
#MARIADB_TAG=10.5-3.15.0
#MARIADB_TAG=10.4-3.15.0
#MARIADB_TAG=10.3-3.15.0
### --- VANILLA DRUPAL ----
DRUPAL_TAG=9-4.36.9
#DRUPAL_TAG=8-4.36.9
#DRUPAL_TAG=7-4.36.9
### --- PHP ----
# Linux (uid 1000 gid 1000)
#PHP_TAG=7.4-dev-4.29.7
PHP_TAG=8.0-dev-4.29.7
#PHP_TAG=7.3-dev-4.29.7
# macOS (uid 501 gid 20)
#PHP_TAG=8.0-dev-macos-4.29.7
#PHP_TAG=7.4-dev-macos-4.29.7
#PHP_TAG=7.3-dev-macos-4.29.7
### --- NGINX ----
NGINX_TAG=1.21-5.16.3
#NGINX_TAG=1.20-5.16.3
#NGINX_TAG=1.19-5.16.3
NGINX_VHOST_PRESET=drupal9
#NGINX_VHOST_PRESET=drupal8
#NGINX_VHOST_PRESET=drupal7
### --- SOLR ---
SOLR_CONFIG_SET="search_api_solr_4.1.6"
#SOLR_CONFIG_SET="search_api_solr_4.0.1"
#SOLR_CONFIG_SET="search_api_solr_8.x-3.9"
#SOLR_CONFIG_SET="search_api_solr_8.x-3.2"
#SOLR_CONFIG_SET="search_api_solr_8.x-2.7"
#SOLR_CONFIG_SET="search_api_solr_8.x-1.2"
#SOLR_CONFIG_SET="search_api_solr_7.x-1.14"
SOLR_TAG=8-4.13.0
#SOLR_TAG=7-4.13.0
#SOLR_TAG=6-4.13.0
#SOLR_TAG=5-4.13.0
### --- ELASTICSEARCH ---
ELASTICSEARCH_TAG=7-5.13.12
#ELASTICSEARCH_TAG=6-5.13.12
### --- KIBANA ---
KIBANA_TAG=7-5.13.12
#KIBANA_TAG=6-5.13.12
### --- REDIS ---
REDIS_TAG=6-3.9.5
#REDIS_TAG=5-3.9.5
### --- NODE ---
NODE_TAG=16-dev-0.97.0
#NODE_TAG=14-dev-0.97.0
#NODE_TAG=12-dev-0.97.0
### --- VARNISH ---
VARNISH_TAG=6.0-4.7.7
#VARNISH_TAG=4.1-4.7.7
### --- POSTGRESQL ----
POSTGRES_TAG=13-1.23.3
#POSTGRES_TAG=12-1.23.3
#POSTGRES_TAG=11-1.23.3
#POSTGRES_TAG=10-1.23.3
#POSTGRES_TAG=9.6-1.23.3
### OTHERS
ADMINER_TAG=4-3.16.0
APACHE_TAG=2.4-4.6.3
ATHENAPDF_TAG=2.16.0
DRUPAL_NODE_TAG=1.0-2.0.0
MEMCACHED_TAG=1-2.9.4
OPENSMTPD_TAG=6.0-1.10.4
RSYSLOG_TAG=latest
SELENIUM_CHROME_TAG=3.141
WEBGRIND_TAG=1-1.22.0
XHPROF_TAG=3.0.5
Thank you
maybe this can help
@notahdev Try to set same IDE key in chrome extension options.