Skip to content

Commit 3079893

Browse files
committed
Remove --with-pear and add Xdebug support in PHP-FPM and CLI Dockerfiles:
- Remove `--with-pear` from PHP-FPM and CLI Dockerfiles. - Add Xdebug as part of the build process with version 3.4.5. - Configure Xdebug settings for development in PHP-FPM.
1 parent 5895eaf commit 3079893

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

docker/php/cli/base/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ RUN ./configure \
9696
--with-openssl \
9797
--with-password-argon2 \
9898
--with-pcre-jit \
99-
--with-pear \
10099
--with-pgsql \
101100
--with-pdo-pgsql \
102101
--with-sodium=shared \

docker/php/fpm/base/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ RUN ./configure \
9292
--with-mhash \
9393
--with-openssl \
9494
--with-password-argon2 \
95-
--with-pear \
9695
--with-pgsql \
9796
--with-pdo-pgsql \
9897
--with-sodium=shared \
@@ -113,7 +112,8 @@ WORKDIR /usr/local/src/modules
113112
RUN git clone -q https://github.com/igbinary/igbinary.git igbinary \
114113
&& git clone -q https://github.com/phpredis/phpredis.git --branch 6.1.0 phpredis \
115114
&& git clone -q https://github.com/krakjoe/apcu.git apcu \
116-
&& git clone -q https://github.com/php/pecl-file_formats-yaml.git yaml
115+
&& git clone -q https://github.com/php/pecl-file_formats-yaml.git yaml \
116+
&& git clone -q https://github.com/xdebug/xdebug.git --branch 3.4.5 xdebug;
117117

118118
# Build & install modules against /opt/php
119119
WORKDIR /usr/local/src/modules/igbinary
@@ -136,11 +136,16 @@ RUN /opt/php/bin/phpize \
136136
&& ./configure --with-yaml --with-php-config=/opt/php/bin/php-config \
137137
&& make -j "$(nproc)" && make install
138138

139+
WORKDIR /usr/local/src/modules/yaml
140+
RUN /opt/php/bin/phpize \
141+
&& ./configure --with-php-config=/opt/php/bin/php-config \
142+
&& make -j "$(nproc)" && make install
143+
139144
# Collect built artifacts for reuse (+ shared ini set)
140145
RUN set -eux; \
141146
EXT_DIR="$(/opt/php/bin/php -r 'echo ini_get("extension_dir");')"; \
142147
mkdir -p /mods/ext /mods/conf.d; \
143-
cp -a "$EXT_DIR"/apcu.so "$EXT_DIR"/igbinary.so "$EXT_DIR"/redis.so "$EXT_DIR"/yaml.so /mods/ext/; \
148+
cp -a "$EXT_DIR"/apcu.so "$EXT_DIR"/igbinary.so "$EXT_DIR"/redis.so "$EXT_DIR"/yaml.so "$EXT_DIR"/xdebug.so /mods/ext/; \
144149
printf "expose_php=0\nmemory_limit=256M\nmax_execution_time=120\n" > /mods/conf.d/10-base.ini; \
145150
printf "opcache.enable=1\nopcache.jit=tracing\nopcache.jit_buffer_size=100M\n" > /mods/conf.d/20-opcache.ini; \
146151
echo "extension = apcu.so" > /mods/conf.d/15-apcu.ini; \
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# The base images (fully qualified, e.g. ghcr.io/ORG/php:*.*.*-fpm)
22
ARG BASE_IMAGE
33

4-
FROM ${BASE_IMAGE} AS fpm-dev
4+
FROM ${BASE_IMAGE} AS x-debug
55

66
USER root
77
RUN apt-get update && apt-get install -y --no-install-recommends git curl unzip vim && rm -rf /var/lib/apt/lists/*
88

9-
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
10-
11-
RUN /opt/php/bin/pecl install xdebug pcov || true && \
9+
RUN -set eux; \
1210
echo "zend_extension=xdebug.so" > /etc/php/conf.d/80-xdebug.ini && \
1311
echo "xdebug.mode=debug,develop" >> /etc/php/conf.d/80-xdebug.ini && \
1412
echo "xdebug.start_with_request=trigger" >> /etc/php/conf.d/80-xdebug.ini && \
1513
echo "xdebug.client_host=host.docker.internal" >> /etc/php/conf.d/80-xdebug.ini && \
1614
echo "opcache.validate_timestamps=1" > /etc/php/conf.d/95-dev.ini && \
1715
echo "display_errors=1" >> /etc/php/conf.d/95-dev.ini
16+
17+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
18+
1819
USER app

0 commit comments

Comments
 (0)