Answer the question
In order to leave comments, you need to log in
Why doesn't XDebug work with Docker?
I want to set up locally Docker(WSL2) + VS Code + XDebug 3.
I googled and searched the forums, but this bundle does not work. Configs:
xdebug.ini
[XDebug]
xdebug.mode = develop
xdebug.start_with_request = yes
xdebug.client_host = host.docker.internal
xdebug.client_port = 9003
version: '3'
networks:
default:
driver: bridge
services:
frontend:
build: frontend
ports:
- 20080:80
volumes:
# Re-use local composer cache via host-volume
- ~/.composer-docker/cache:/root/.composer/cache:delegated
# Mount source-code for development
- ./:/app
backend:
build: backend
ports:
- 21080:80
volumes:
# Re-use local composer cache via host-volume
- ~/.composer-docker/cache:/root/.composer/cache:delegated
# Mount source-code for development
- ./:/app
php:
image: yiisoftware/yii2-php:7.2-apache
volumes:
- ~/.composer-docker/cache:/root/.composer/cache:delegated
- ./:/app:delegated
- ./docker/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
- ./docker/apache/000-default.conf:/etc/apache2/sites-available/000-default.conf
environment:
- PHP_ENABLE_XDEBUG=1
- XDEBUG_CLIENT_PORT=9003
ports:
- '80:80'
networks:
- default
depends_on:
- db
db:
image: mysql:5.7.16
restart: always
environment:
- MYSQL_DATABASE=yii2advanced
- MYSQL_USER=user
- MYSQL_PASSWORD=root
- MYSQL_ROOT_PASSWORD=root
ports:
- '13306:3306'
command: mysqld --sql_mode='' --character-set-server=utf8 --collation-server=utf8_general_ci
volumes:
- ./docker/mysql:/var/lib/mysql
networks:
- default
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- '8888:80'
environment:
- PMA_ARBITRARY=1
- PMA_HOST=db
depends_on:
- db
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"app": "${workspaceFolder}"
},
"hostname": "localhost"
}
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question