Skip to content

Instantly share code, notes, and snippets.

@reanim8ed
Last active July 30, 2021 09:17
Show Gist options
  • Save reanim8ed/b5815cd2e04c7a66ed5512814c0e2c08 to your computer and use it in GitHub Desktop.
Save reanim8ed/b5815cd2e04c7a66ed5512814c0e2c08 to your computer and use it in GitHub Desktop.
[Xdebug in docker] #xdebug
  1. In docker-compose.yml expose 9000 port for php:
version: '3'

services:

  webserver:
    image: nginx:latest
    ports:
      - 8080:80
    volumes:
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
      - ./:/var/www/html

  php:
    build: ./docker/php/
    expose:
      - 9000
    volumes:
      - .:/var/www/html
      - ./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  1. Install Xdebug 3 in the PHP container:
  • ./docker/php/Dockerfile
    FROM php:7.4-fpm
    
    RUN pecl install xdebug \
        && docker-php-ext-enable xdebug
    
  1. Configure Xdebug for Step Debugging:
  • Create the configuration file: docker/php/conf.d/xdebug.ini:
      zend_extension=xdebug
    
      [xdebug]
      xdebug.mode=develop,debug
      xdebug.client_host=host.docker.internal
      xdebug.start_with_request=yes
    
  1. In PHP strom Xdebug settings use 9003 port

======

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment