Хочу настроить XDEbug в связке Docker + XDebug + VSCode, делал по разным источникам в гугле и ютубе.
Результат:
Дебаг запускается, НО точки останова не работают.
Файлы с конфигурациями:
1) launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9004,
"pathMappings": {
"/var/www/html/": "C:/docker/src"
},
}
]
}
2)docker-compose.yml
version: '3'
services:
apache:
container_name: apache
# image: httpd:2.4
build:
./httpd
extra_hosts:
- "s4.dev.ranepa.local:127.0.0.1"
hostname: s4.dev.ranepa.local
domainname: local
ports:
- 80:80
volumes:
- ./src:/var/www/html
# - ./src/crm.ranepa.ru/bitrix:/var/www/html/s4.dev.ranepa.ru/bitrix
# - ./src/crm.ranepa.ru/local:/var/www/html/s4.dev.ranepa.ru/local
# - ./src/crm.ranepa.ru/upload:/var/www/html/s4.dev.ranepa.ru/upload
- ./httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./httpd/ranepa.conf:/usr/local/apache2/sites-enabled/ranepa.conf
# - ./httpd/s4.dev.ranepa.conf:/etc/apache2/sites-enabled/s4.dev.ranepa.conf
- ./php/php.ini:/usr/local/etc/php/php.ini
depends_on:
- php
# - redis
networks:
vpcbr:
ipv4_address: 100.0.0.10
# /s4.dev.ranepa.ru
# /var/www/bitrix24/src/s4.dev.ranepa.ru/bitrix/php_interface/dbconn.php - настройки подключений к бд
#--enable-redis-igbinary
#https://github.com/ezsystems/docker-php/blob/master/php/Dockerfile-7.0
# nginx:
# image: nginx:1.13
# ports:
# - 80:80
# volumes:
# - ./src:/var/www/html
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf
# depends_on:
# - apache
# php:
# image: php:7.1-fpm
# volumes:
# - ./src:/var/www/html
php:
container_name: php
build:
./php
# ports:
# - 9003:9003
volumes:
- ./src:/var/www/html
# - ./src/crm.ranepa.ru/bitrix:/var/www/html/s4.dev.ranepa.ru/bitrix
# - ./src/crm.ranepa.ru/local:/var/www/html/s4.dev.ranepa.ru/local
# - ./src/crm.ranepa.ru/upload:/var/www/html/s4.dev.ranepa.ru/upload
- ./php/php.ini:/usr/local/etc/php/php.ini
environment:
XDEBUG_CONFIG: "remote_host=100.0.0.11 remote_enable=1"
# XDEBUG_CONFIG: "remote_host=host.docker.internal"
PHP_IDE_CONFIG: "serverName=DockerLk"
networks:
vpcbr:
ipv4_address: 100.0.0.11
redis:
container_name: redis
image: redis
ports:
- "6379:6379"
volumes:
- ./redis_data:/data
restart: always
networks:
vpcbr:
ipv4_address: 100.0.0.12
networks:
vpcbr:
driver: bridge
ipam:
config:
- subnet: 100.0.0.0/16
# gateway: 100.0.0.1
Запускаю 3 контейнера
skrinshoter.ru/s/170220/6P8JK8bj?a
3) файл Dockerfile в php
FROM php:7.1-fpm
# Get repository and install wget and vim
RUN apt-get update && apt-get install --no-install-recommends -y \
wget \
gnupg \
git \
unzip
# Install PHP extensions deps
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
zlib1g-dev \
libicu-dev \
g++ \
unixodbc-dev \
libxml2-dev \
libaio-dev \
libmemcached-dev \
freetds-dev \
libssl-dev \
openssl \
libgeoip-dev \
libbz2-dev \
gettext \
libldap2-dev \
libpspell-dev \
librrd-dev \
libgeoip-dev
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin \
--filename=composer
# Install APCu and APC backward compatibility
RUN pecl install apcu \
&& pecl install apcu_bc-1.0.3 \
&& docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini \
&& docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu \
&& pecl install sqlsrv-4.1.6.1 \
&& pecl install pdo_sqlsrv-4.1.6.1 \
&& pecl install memcached \
&& pecl install xdebug-2.5.5 \
# && pecl install igbinary-2.0.1 \
# && pecl install redis \
&& pecl install memcache \
&& pecl install msgpack \
&& pecl install rrd \
&& pecl install geoip-1.1.1 \
&& docker-php-ext-install \
iconv \
mbstring \
intl \
mcrypt \
gd \
mysqli \
pdo_mysql \
pdo_dblib \
soap \
sockets \
zip \
pcntl \
ftp \
bz2 \
calendar \
exif \
gettext \
ldap \
pspell \
shmop \
&& docker-php-ext-enable \
sqlsrv \
pdo_sqlsrv \
memcached \
opcache \
xdebug \
# igbinary \
# redis \
memcache \
msgpack \
rrd \
geoip
# Enable igbinary & PHP Redis ext using igbinary
#RUN pecl install -o -f igbinary && y | pecl install redis && docker-php-ext-enable redis igbinary
# Install igbinary (for more efficient serialization in redis/memcached)
RUN for i in $(seq 1 3); do pecl install -o igbinary && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& docker-php-ext-enable igbinary \
\
# Install redis (manualy build in order to be able to enable igbinary)
&& for i in $(seq 1 3); do pecl install -o --nobuild redis && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& cd "$(pecl config-get temp_dir)/redis" \
&& phpize \
&& ./configure --enable-redis-igbinary \
&& make \
&& make install \
&& docker-php-ext-enable redis \
&& cd - \
\
# Clean repository
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# The path that will be used to make Apache run under that user
#ENV VOLUME_PATH /var/www/html
# Move files
#COPY src/ /var/www/html/
#COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
#ADD ./php.ini /usr/local/etc/php/php.ini
#WORKDIR /var/www/html/
#RUN chown -R www-data:www-data /var/www/html/
#RUN usermod -u 1000 www-data
#RUN groupmod -g 1000 www-data
# && a2enmod rewrite