Bonjour,
J'espère que je suis au bon endroit et je vous remercie par avance pour votre temps.

Je suis sous un environnement docker avec séparation des container PHP et Apache.
J'utilise PHP8.2 et Symfony 7.1. j'essaye de rajouter Xdebug afin de pouvoir résoudre un problème de code SF.
Quoi qu'il en soit malgré les nombreux tutos suivit le débugger de VScode ne réagit pas malgré mes points d'arrêts.

Voici ma configuration docker:
dockerCompose
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
version: '3.9'
 
networks:
    docker.network:
        driver: bridge
 
services:
    db:
        image: mysql
        container_name: mysql
        restart: always
        ports:
            - "3306:8080"
        networks:
            - docker.network
        environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: Yes
        volumes:
            - ./db/db_data:/var/lib/mysql
 
    apache:
        image: httpd
        container_name: apache
        ports:
            - "80:80"
            #- "443:443"
        networks:
            - docker.network
        volumes:
            - ../:/var/www
            - ./apache/httpd-vhosts.conf:/usr/local/apache2/conf/extra/httpd-vhosts.conf
            - ./apache/commun.conf:/usr/local/apache2/conf/extra/commun.conf
            - ./apache/httpd.conf:/usr/local/apache2/conf/httpd.conf
            - ./hosts:/etc/hosts  # Monter le fichier hosts
 
 
    php82:
        build: ./php/php8.2
        container_name: php82
        volumes:
           - ../:/var/www
           - ./php/php.ini:/etc/php/8.2/fpm/conf.d/30-custom.ini
           - ./php/php.ini:/etc/php/8.2/cli/conf.d/30-custom.ini
           - ./php/php.ini:/usr/local/etc/php/conf.d/30-custom.ini
           - ./hosts:/etc/hosts  # Monter le fichier hosts
        environment:
            - TZ=Europe/Paris
        ports:
            - "9000:9000"
            - "9004:9004"
        restart: always
        networks:
            - docker.network
        extra_hosts:
            - host.docker.internal:host-gateway
 
    phpmyadmin:
        image: phpmyadmin
        container_name: phpmyadmin
        ports:
            - "86:80"
        networks:
            - docker.network
 
    mailer:
        image: mailhog/mailhog
        container_name: mailer
        ports:
            - "1025:1025"
            - "8025:8025"
        networks:
            - docker.network
DockerFile
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
# From
FROM phpdockerio/php:8.2-fpm
 
ARG DEBIAN_FRONTEND=noninteractive
 
# Run
RUN apt-get update
 
# Install Nano
RUN apt-get install -y nano
 
RUN apt-get install -y php8.2-mysqli
 
# Install necessary packages for pecl and ODBC
RUN apt-get update && apt-get install -y \
    php-pear \
    php8.2-dev \
    gcc \
    g++ \
    make \
    autoconf \
    libc-dev \
    pkg-config \
    unixodbc-dev \
    libxml2-dev \
    php-xml 
 
RUN apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    libzip-dev \
    zip \
    && pecl install gd \
    && docker-php-ext-enable gd \
    && pecl install mysqli \
    && docker-php-ext-enable mysqli \
    && pecl install pdo \
    && docker-php-ext-enable pdo \
    && pecl install pdo_mysql \
    && docker-php-ext-enable pdo_mysql \
    && pecl install zip \
    && docker-php-ext-enable zip \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
 
# Install SQL Server extensions
RUN pecl config-set php_ini /etc/php/8.2/fpm/php.ini \
    && pecl install sqlsrv \
    && pecl install pdo_sqlsrv \
    && printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.2/mods-available/sqlsrv.ini \
    && printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.2/mods-available/pdo_sqlsrv.ini \
    && phpenmod -v 8.2 sqlsrv pdo_sqlsrv
    
# Install necessary packages for MS ODBC Driver
RUN apt-get update && apt-get install -y \
    curl \
    apt-transport-https \
    gnupg
 
# Add Microsoft's repo for the latest ODBC driver for SQL Server
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
 
# Install the MS ODBC driver for SQL Server
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y \
    msodbcsql17 \
    mssql-tools
 
# Ensure the PHP configuration directory exists
RUN mkdir -p /usr/local/etc/php/conf.d
 
# Install Xdebug
RUN pecl install xdebug 
 
# Configure Xdebug
RUN echo "zend_extension=$(find /usr/lib/php/ -name xdebug.so)" > /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.client_port=9000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
    && echo "xdebug.log=/var/log/xdebug.log" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
 
# Créer le répertoire de travail
RUN mkdir -p /var/www
 
# Automatiser les permissions du répertoire
RUN chown -R www-data:www-data /var/www \
    && chmod -R 755 /var/www
30-custom.ini
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
display_errors = On
display_startup_errors = On
log_errors = On
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
directorypermissions = "0775"
date.timezone = Europe/Paris
 
max_execution_time = 500
max_input_time = 500
memory_limit = 256M
 
; zend_extension=/usr/lib/php/20220829/xdebug.so
; xdebug.mode=debug
; xdebug.start_with_request=yes
; xdebug.client_host=172.0.0.1
; xdebug.client_port=9004
 
zend_extension=/usr/lib/php/20220829/xdebug.so
; ; zend_extension=xdebug.so
xdebug.mode=debug
xdebug.idekey=XDEBUG_SESSION_START
xdebug.start_with_request=yes
xdebug.log=/dev/stdout
xdebug.log_level=0
xdebug.client_port=9000
xdebug.client_host=host.docker.internal
xdebug.discover_client_host=true
xdebug.remote_host=host.docker.internal
j'ai fait un php_info() ou j'ai bien l'instanciation de Xdebug
Nom : Capture d’écran 2024-08-13 152317.png
Affichages : 38
Taille : 61,3 Ko

J'ai ensuite configuré mon VSCode avec l'extension php debug, et le paramétrage du débugger. Voici mon fichier lunch.json
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "hostname": "127.0.0.1",
            "pathMappings": {
                "/var/www": "${workspaceFolder}"
            }
        }
    ]
}

J'ai testé soit avec POSTMAN soit en appelant directement l'url http://datalookup.local/index.php/lookup/liste-marques
Pour les navigateurs, j'ai rajouté l'extension debbug helper, qui est activée. Malheureusement, absolument, rien ne se passe dans VSCode.
J'ai testé avec un autre port 9004, que j'ai ouvert sur le container docker, mais rien.

Je ne sais plus trop où donner de la tête. Pouvez-vous m'aider ?
Avez-vous besoin d'information complémentaire ?