Skip to content

Php xdebug with traefik configuration #11

@Smolevich

Description

@Smolevich

Codebase

Host OS

e.g. macOS Sierra
macOS Mojave 10.14.6

Docker info output

Client:
 Debug Mode: false

Server:
 Containers: 27
  Running: 7
  Paused: 0
  Stopped: 20
 Images: 96
 Server Version: 19.03.4
 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: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.184-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 1.952GiB
 Name: docker-desktop
 ID: 6YM6:LMGB:PQ2E:LXSH:24FU:CQ7H:5MVG:TIVF:H5UB:7DEI:72DW:BGT2
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 84
  Goroutines: 89
  System Time: 2019-10-29T14:35:25.592707274Z
  EventsListeners: 3
 HTTP Proxy: gateway.docker.internal:3128
 HTTPS Proxy: gateway.docker.internal:3129
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

nginx:
image: wodby/nginx
container_name: "simple-service-2"
environment:
NGINX_SERVER_ROOT: /var/www/html/public
NGINX_ERROR_LOG_LEVEL: debug
NGINX_BACKEND_HOST: php
NGINX_VHOST_PRESET: php
NGINX_FASTCGI_INDEX: index.php
labels:
- "traefik.http.routers.nginx_test.rule=Host(nginx.docker.localhost)"
- "traefik.http.routers.nginx_test.entrypoints=web"
volumes:
- ./.docker/nginx:/var/www/html/public:rw
depends_on:
- php

php:
image: wodby/php:7.3
container_name: "simple-service-3"
environment:
PHP_FPM_CLEAR_ENV: "no"
PHP_XDEBUG: 1
PHP_XDEBUG_DEFAULT_ENABLE: 1
PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
PHP_XDEBUG_IDEKEY: "vscode"
PHP_IDE_CONFIG: serverName=vscode
PHP_FPM_USER: wodby
PHP_FPM_GROUP: wodby
PHP_XDEBUG_REMOTE_HOST: host.docker.internal
PHP_XDEBUG_REMOTE_LOG: /tmp/php-xdebug.log
volumes:
- ./.docker/nginx:/var/www/html/public:rw

networks:
traefik_proxy:
driver: bridge
name: traefik_proxy


### Logs output

simple-service-3 | [29-Oct-2019 14:33:41] NOTICE: fpm is running, pid 1
simple-service-3 | [29-Oct-2019 14:33:41] NOTICE: ready to handle connections
simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:33:45 +0000 "GET /index.php" 200
simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:33:47 +0000 "GET /index.php" 200
simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:55:16 +0000 "GET /index.php" 200
simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:56:26 +0000 "GET /index.php" 200

php-xdebug.log:

[85] Log opened at 2019-10-29 14:56:26
[85] I: Connecting to configured address/port: host.docker.internal:9000.
[85] I: Connected to client. :-)
[85] ->
[85]
[85] ->
[85]
[85] Log closed at 2019-10-29 14:56:26
[85]


But debug in Visual Studio Code doesn't work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions