0

as you know the debugging tool is a one way road for any developer and in this case I bring you this problem that I am trying to solve for a long time and I can't. I am trying to solve it. I am in a Magento-Docker project where I have the following containers:

enter image description here

My docker-compose.yml file.

    version: '3'

services:
  db:
    container_name: magento-mysql
    image: mysql:${MYSQL_VERSION}
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    volumes:
       - $PWD/mysql/data:/var/lib/mysql
    ports:
      - "3306:3306"
    networks:
      - my_net_b2c
  nginx:
    container_name: magento-nginx
    tty: true
    build:
      context: $PWD/nginx/${NGINX_VERSION}
    ports:
      - "80:80"
    links:
      - phpfpm
      - redis:cache
    volumes:
      - $PWD/magento/code:/var/www/html
      - $PWD/nginx/log/error.log:/var/log/nginx/error.log
      - $PWD/nginx/log/access.log:/var/log/nginx/access.log
      - $PWD/nginx/sock:/sock
    networks:
      my_net_b2c:
        ipv4_address: ${NGINX_IP}
  phpfpm:
    container_name: magento-phpfpm
    extra_hosts:
      - ${MOVISTAR_HOST_NAME}:${NGINX_IP}
    build:
      context: $PWD/php/${PHP_VERSION}
    links:
      - db
    volumes:
      - $PWD/php/${PHP_VERSION}/.composer:/var/www/.composer
      - $PWD/magento/code:/var/www/html
      - $PWD/nginx/sock:/sock
    networks:
      - my_net_b2c
  elasticsearch:
    container_name: magento-elasticsearch
    image: elasticsearch:${ELASTICSEARCH_VERSION}
    restart: always
    environment:
      - xpack.security.enabled=false
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    ports:
      - 9200:9200
    volumes:
      - $PWD/elasticsearch/esdata1:/usr/share/elasticsearch/data
      - $PWD/elasticsearch/es_log1:/var/log/elasticsearch
    networks:
      - my_net_b2c
  cron:
    container_name: magento-cron
    build:
      context: $PWD/php/${PHP_VERSION}
    user: root
    command: /usr/local/bin/cronstart
    tty: true
    links:
      - db
      - elasticsearch
      - rabbitmq
    volumes:
      - $PWD/magento/code:/var/www/html
      - $PWD/nginx/sock:/sock
    networks:
      - my_net_b2c
  rabbitmq:
    container_name: magento-rabbitmq
    image: rabbitmq:${RABBITMQ_VERSION}
    environment:
      - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
      - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
    ports:
      - 15672:15672
      - 5672:5672
    networks:
      - my_net_b2c
  redis:
    container_name: magento-redis
    image: redis:${REDIS_VERSION}
    restart: on-failure:5
    ports:
      - 6379:6379
    networks:
      - my_net_b2c
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8580:80"
    links:
      - db
    networks:
      - my_net_b2c
      
networks:
  my_net_b2c:
      ipam:
        driver: default
        config:
          - subnet: 172.22.0.0/16

I want to install and configure xdebug but I do not know how to configure it and I am struggling with this for a long time since I need it to work, if anyone has a way to help me to follow the configuration would be ideal to contact me and we can do the step by step as it would help me a lot and then I can help a colleague.

Thank you very much and I hope you can help me

1 Answer 1

0

Add the following to the docker build file for your PHP container

RUN set -x \
    && pecl install xdebug-3.1.0 \
    && docker-php-ext-enable xdebug

to confirm xdebug is installed run the following in your php container

php -m | grep -i xdebug
1
  • whats the location of this docker file? Commented Feb 14 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.