I have a problem with Xdebug, this is my Docker configuration:
Dockerfile:
FROM php:8.1.10-fpm-alpine
RUN apk update
RUN apk add php81-dev gcc make g zlib-dev icu-dev bash git openssl yaml-dev
RUN pecl channel-update pecl.php.net
# For YAML
RUN apk add --update --no-cache \
yaml && \
# Build dependancy for YAML \
apk add --update --no-cache --virtual .yaml-build \
yaml-dev && \
pecl install yaml && \
docker-php-ext-enable yaml; \
apk del .yaml-build
# For Xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug
RUN echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# For code coverage
RUN echo "memory_limit=-1" >> /usr/local/etc/php/conf.d/docker-php-memory-limit.ini
COPY --from=composer /usr/bin/composer /usr/bin/composer
SHELL ["/bin/bash", "-c"]
WORKDIR /var/www/html
docker-compose.yml:
version: '3'
services:
php:
build:
context: ./
dockerfile: Dockerfile
volumes:
- "./:/var/www/html"
- "~/.composer:/root/.composer"
When I check the PHP information of my Docker image, everything seems correct:
PHP 8.1.10 (cli) (built: Sep 1 2022 21:43:31) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.10, Copyright (c) Zend Technologies
with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
In PhpStorm, I setup correctly my remote PHP Interpreter with Docker Compose option.
The problem is here:
The displayed error:
Cannot parse PHPUnit version output: Xdebug: [Config] The setting 'xdebug.remote_enable' has been renamed, see the upgrading guide at
Can you help me, please?
CodePudding user response:
If I remove it, Xdebug is not activated and so I cannot with PHPStorm see the files covered by my tests.
That's not right, if you want to have both coverage and the step debugger in with Xdebug 3, you need to change:
RUN echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
To:
RUN echo "xdebug.mode=coverage,debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
And remove the
xdebug.remote_enable
setting from wherever you set it.