Browse Source

after all this years galering with php debuging i finally manage to get xdebug working, it's the first day of my new dev lifegit add ressources/xdebug.conf.example git add ressources/xdebug.conf.example

Bachir Soussi Chiadmi 3 years ago
parent
commit
836e6586b8
7 changed files with 20 additions and 2 deletions
  1. 2 0
      .env
  2. 1 0
      .gitignore
  3. 1 0
      Docker/php/Dockerfile
  4. 1 1
      Docker/php/bashrc
  5. 1 1
      Docker/php/php-custom.ini
  6. 5 0
      docker-compose.yml
  7. 9 0
      ressources/xdebug.conf.example

+ 2 - 0
.env

@@ -12,3 +12,5 @@ DB_NAME=materio_d8
 DB_LEGACY_NAME=materio_d7
 DB_USERNAME=materio
 DB_PASSWORD=materio
+
+XDEBUG_CONF=./ressources/xdebug.conf

+ 1 - 0
.gitignore

@@ -5,3 +5,4 @@ log/*
 *.sql
 bin/syncfiles.sh
 solr_cores/*
+ressources/xdebug.conf

+ 1 - 0
Docker/php/Dockerfile

@@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y \
 		mysql-client \
     zip \
     libzip-dev && \
+		cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini && \
 		# docker-php-ext-install -j$(nproc) iconv && \
 		docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
 		apt-get install -y imagemagick libmagickwand-dev && \

+ 1 - 1
Docker/php/bashrc

@@ -1,4 +1,4 @@
 
-PS1='\e[36m\e[1mPHP-7.0\e[0m:\e[90m\w\e[0m\n$ '
+PS1='\e[36m\e[1mPHP-7.3\e[0m:\e[90m\w\e[0m\n$ '
 bind '"\e[A": history-search-backward'
 bind '"\e[B": history-search-forward'

+ 1 - 1
Docker/php/php-custom.ini

@@ -1,4 +1,4 @@
-memory_limit = 2048M
+memory_limit = 8192M
 upload_max_filesize = 50M
 post_max_size = 50M
 max_execution_time = 150

+ 5 - 0
docker-compose.yml

@@ -79,18 +79,23 @@ services:
     build: ./Docker/php/
     expose:
       - 9000
+      - 9001
     user: ${USER_UID}:${USER_GID}
     volumes:
       - php-user-data:/home/${USER_UNAME}
       - "${PROJECT_ROOT}:/var/www/html/d8.materio.com/public_html"
       - "${LEGACY_ROOT}:/var/www/html/d7.materio.com/public_html"
       - "${LOG_ROOT}/php:/var/log:rw"
+      - "${XDEBUG_CONF}:/usr/local/etc/php/conf.d/xdebug.ini"
     working_dir: "/var/www/html/d8.materio.com/public_html"
     networks:
       - database
       - redis
       - server
       - solr
+    # extra_hosts:
+      # - "host.docker.internal:192.168.144.4"
+      # - "testhost:192.168.0.21"
     depends_on:
       - mysql
       - mysql-legacy

+ 9 - 0
ressources/xdebug.conf.example

@@ -0,0 +1,9 @@
+[xdebug]
+xdebug.remote_enable=1
+xdebug.remote_host=172.20.0.1   # Should use host.docker.internal but not working on linux
+xdebug.remote_connect_back=0    # Not working on docker context
+xdebug.remote_port=9001         # 9000 is already bound by php-fpm
+xdebug.remote_handler=dbgp
+xdebug.remote_mode=req
+xdebug.remote_autostart=true
+xdebug.remote_log=/var/log/xdebug-error.log # Log file is mounted on volume so you can follow it