wodby / docker4wordpress

Docker-based WordPress stack
https://wodby.com/docker4wordpress
MIT License
741 stars 218 forks source link

Can't enable Xdebug when using the 7.2 branch #26

Closed proteo closed 6 years ago

proteo commented 6 years ago

Hi Chingis, thanks for your excellent work. I'm having a small problem with docker4wordpress, hope you can give me a hint.

I've been trying to enable xdebug without success. As you can see in the docker-compose.yml info (at the bottom) the definition includes the required flags, plus the ones required for macOS:

PHP_XDEBUG: 1 PHP_XDEBUG_DEFAULT_ENABLE: 1 PHP_XDEBUG_REMOTE_CONNECT_BACK: 0 PHP_XDEBUG_REMOTE_HOST: "10.254.254.254" PHP_XDEBUG_PROFILER_OUTPUT_DIR: /mnt/files/xdebug/profiler PHP_XDEBUG_TRACE_OUTPUT_DIR: /mnt/files/xdebug/traces

However, my IDE (PHPStorm) can't see the debugger. It looks like no xdebug extension is loaded, since the output of php_info() doesn't include any information about it:

PHP version: 7.2.0

PHP CLI:
/usr/local/bin/php
PHP CGI: Not Installed (php-cgi sapi is necessary to use built-in web server) 

Loaded Configuration File: Not Found

Additional .ini files parsed:
/usr/local/etc/php/conf.d/docker-php-ext-amqp.ini
/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
/usr/local/etc/php/conf.d/docker-php-ext-ast.ini
/usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
/usr/local/etc/php/conf.d/docker-php-ext-bz2.ini
/usr/local/etc/php/conf.d/docker-php-ext-calendar.ini
/usr/local/etc/php/conf.d/docker-php-ext-exif.ini
/usr/local/etc/php/conf.d/docker-php-ext-gd.ini
/usr/local/etc/php/conf.d/docker-php-ext-geoip.ini
/usr/local/etc/php/conf.d/docker-php-ext-imagick.ini
/usr/local/etc/php/conf.d/docker-php-ext-imap.ini
/usr/local/etc/php/conf.d/docker-php-ext-intl.ini
/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini
/usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini
/usr/local/etc/php/conf.d/docker-php-ext-memcached.ini
/usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini
/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini
/usr/local/etc/php/conf.d/docker-php-ext-oauth.ini
/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
/usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
/usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
/usr/local/etc/php/conf.d/docker-php-ext-pgsql.ini
/usr/local/etc/php/conf.d/docker-php-ext-redis.ini
/usr/local/etc/php/conf.d/docker-php-ext-soap.ini
/usr/local/etc/php/conf.d/docker-php-ext-sockets.ini
/usr/local/etc/php/conf.d/docker-php-ext-uploadprogress.ini
/usr/local/etc/php/conf.d/docker-php-ext-xmlrpc.ini
/usr/local/etc/php/conf.d/docker-php-ext-xsl.ini
/usr/local/etc/php/conf.d/docker-php-ext-yaml.ini
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini

Debugger extension: Not Found

Loaded extensions:  amqp, apcu, ast, bcmath, bz2, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, geoip, hash, iconv, imagick, imap, intl, json, ldap, libxml, mbstring, mcrypt, memcached, mongodb, mysqli, mysqlnd, OAuth, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, redis, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tokenizer, uploadprogress, xml, xmlreader, xmlrpc, xmlwriter, xsl, yaml, Zend OPcache, zip, zlib

I've tried using one of to other images suggested (like wodby/wordpress-php:7.2-3.3.1), with no luck. Even tried using wodby/php directly –which seems to work fine BTW– but still, it won't load xdebug. As a side note, I've been using your docker4drupal image for a while with fantastic results, and xdebug works just fine there.

Any help will be greatly appreciated, many thanks in advance.

Codebase

Tried both (first with the default named volume, then with my own codebase).

Host OS

macOS Sierra

Docker info output

Containers: 16
 Running: 10
 Paused: 0
 Stopped: 6
Images: 234
Server Version: 17.12.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 480
 Dirperm1 Supported: 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 logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.60-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.855GiB
Name: linuxkit-025000000001
ID: NHNB:QGFY:NNWC:7YBC:J5B5:KQXR:4FB5:EIMQ:KDAX:CRRS:M2N2:KRVV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Docker compose file

version: "2"

services:
  wordpress_php:
    image: wodby/wordpress:4-7.2-3.3.1
    container_name: wordpress_php
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      PHP_FPM_CLEAR_ENV: "no"
      DB_HOST: mysql
      DB_USER: XXX
      DB_PASSWORD: XXX
      DB_NAME: wordpress
      DB_DRIVER: mysql
      PHP_XDEBUG: 1
      PHP_XDEBUG_DEFAULT_ENABLE: 1
      PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
      PHP_XDEBUG_REMOTE_HOST: "10.254.254.254"
      PHP_XDEBUG_PROFILER_OUTPUT_DIR: /mnt/files/xdebug/profiler
      PHP_XDEBUG_TRACE_OUTPUT_DIR: /mnt/files/xdebug/traces
      PHP_BLACKFIRE: 1
    external_links:
      - mysql
    networks:
      - dockernet
    volumes:
      - ./html:/var/www/html:cached
  web:
    image: wodby/wordpress-nginx:4-1.13-3.0.2
    container_name: wordpress
    environment:
      NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: debug
      NGINX_BACKEND_HOST: wordpress_php
    volumes:
      - ./html:/var/www/html:cached
    depends_on:
      - wordpress_php
    external_links:
      - mysql
    networks:
      - dockernet
    labels:
      - 'traefik.enable=true'
      - 'traefik.backend=wordpress'
      - 'traefik.frontend.rule=Host:wordpress.test,www.wordpress.test'
      - 'traefik.docker.network=dockernet'
      - 'traefik.port=80'

networks:
  dockernet:
    external: true

Logs output

wordpress_php    | [12-Jan-2018 18:21:33] NOTICE: fpm is running, pid 1
wordpress_php    | [12-Jan-2018 18:21:33] NOTICE: ready to handle connections
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: using the "epoll" event method
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: nginx/1.13.7
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: built by gcc 6.3.0 (Alpine 6.3.0) 
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: OS: Linux 4.9.60-linuxkit-aufs
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: start worker processes
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: start worker process 28
wordpress        | 2018/01/12 18:21:33 [notice] 1#1: start worker process 29
proteo commented 6 years ago

OK, it looks like the 7.2 branch is the culprit here. After realizing that docker4drupal uses 7.1, I pointed the container to wodby/wordpress:4-7.1-3.3.1 and xdebug works fine now.

csandanov commented 6 years ago

Xdebug didn't support 7.2 version last time we updated images

csandanov commented 6 years ago

With 5.0.0 release php 7.2 supports xdebug