diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 155ef3165b..9e33b8bfa1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ name: GitHub CI on: pull_request: push: + workflow_dispatch: schedule: - cron: 0 0 * * 0 @@ -10,6 +11,13 @@ defaults: run: shell: 'bash -Eeuo pipefail -x {0}' +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: generate-jobs: @@ -18,14 +26,17 @@ jobs: outputs: strategy: ${{ steps.generate-jobs.outputs.strategy }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 + - uses: docker-library/bashbrew@HEAD - id: generate-jobs name: Generate Jobs run: | - git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew - strategy="$(~/bashbrew/scripts/github-actions/generate.sh)" - jq . <<<"$strategy" # sanity check / debugging aid - echo "::set-output name=strategy::$strategy" + strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" + + EOF="EOF-$RANDOM-$RANDOM-$RANDOM" + echo "strategy<<$EOF" >> "$GITHUB_OUTPUT" + jq <<<"$strategy" . | tee -a "$GITHUB_OUTPUT" + echo "$EOF" >> "$GITHUB_OUTPUT" test: needs: generate-jobs @@ -33,7 +44,7 @@ jobs: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Prepare Environment run: ${{ matrix.runs.prepare }} - name: Pull Dependencies diff --git a/.github/workflows/verify-templating.yml b/.github/workflows/verify-templating.yml index 7e833f1c7d..e822ba6bb9 100644 --- a/.github/workflows/verify-templating.yml +++ b/.github/workflows/verify-templating.yml @@ -3,6 +3,7 @@ name: Verify Templating on: pull_request: push: + workflow_dispatch: defaults: run: @@ -13,10 +14,6 @@ jobs: name: Check For Uncomitted Changes runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Apply Templates - run: ./apply-templates.sh - - name: Check Git Status - run: | - status="$(git status --short)" - [ -z "$status" ] + - uses: actions/checkout@v4 + - run: ./apply-templates.sh + - run: git diff --exit-code diff --git a/7.4/alpine3.15/cli/Dockerfile b/7.4/alpine3.15/cli/Dockerfile deleted file mode 100644 index b858e191d0..0000000000 --- a/7.4/alpine3.15/cli/Dockerfile +++ /dev/null @@ -1,208 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.15 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 - -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ -# PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df - ln -sv /usr/include/gnu-libiconv/*.h /usr/include/; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/docker-library/php/pull/1259 - --enable-phpdbg \ - --enable-phpdbg-readline \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/7.4/alpine3.15/zts/Dockerfile b/7.4/alpine3.15/zts/Dockerfile deleted file mode 100644 index 6a72028f46..0000000000 --- a/7.4/alpine3.15/zts/Dockerfile +++ /dev/null @@ -1,211 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.15 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 - -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ -# PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df - ln -sv /usr/include/gnu-libiconv/*.h /usr/include/; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-maintainer-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/7.4/alpine3.16/cli/Dockerfile b/7.4/alpine3.16/cli/Dockerfile deleted file mode 100644 index dd78ac0b75..0000000000 --- a/7.4/alpine3.16/cli/Dockerfile +++ /dev/null @@ -1,208 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.16 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 - -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ -# PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df - ln -sv /usr/include/gnu-libiconv/*.h /usr/include/; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/docker-library/php/pull/1259 - --enable-phpdbg \ - --enable-phpdbg-readline \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/7.4/alpine3.16/fpm/docker-php-ext-install b/7.4/alpine3.16/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/alpine3.16/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/alpine3.16/zts/Dockerfile b/7.4/alpine3.16/zts/Dockerfile deleted file mode 100644 index 2f6949d169..0000000000 --- a/7.4/alpine3.16/zts/Dockerfile +++ /dev/null @@ -1,211 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.16 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 - -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ -# PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df - ln -sv /usr/include/gnu-libiconv/*.h /usr/include/; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-maintainer-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/7.4/alpine3.16/zts/docker-php-ext-install b/7.4/alpine3.16/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/alpine3.16/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/bullseye/apache/docker-php-ext-install b/7.4/bullseye/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/bullseye/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/bullseye/cli/docker-php-ext-install b/7.4/bullseye/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/bullseye/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/bullseye/fpm/docker-php-ext-install b/7.4/bullseye/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/bullseye/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/bullseye/zts/Dockerfile b/7.4/bullseye/zts/Dockerfile deleted file mode 100644 index 2b893be648..0000000000 --- a/7.4/bullseye/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bullseye-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 - -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-maintainer-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/7.4/bullseye/zts/docker-php-ext-install b/7.4/bullseye/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/bullseye/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/buster/apache/docker-php-ext-install b/7.4/buster/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/buster/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/buster/cli/docker-php-ext-install b/7.4/buster/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/buster/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/buster/fpm/docker-php-ext-install b/7.4/buster/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/buster/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/7.4/buster/zts/Dockerfile b/7.4/buster/zts/Dockerfile deleted file mode 100644 index dedb7f611d..0000000000 --- a/7.4/buster/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:buster-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 - -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-maintainer-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/7.4/buster/zts/docker-php-ext-install b/7.4/buster/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/7.4/buster/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/alpine3.15/cli/docker-php-ext-install b/8.0-rc/alpine3.15/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/alpine3.15/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/alpine3.15/fpm/Dockerfile b/8.0-rc/alpine3.15/fpm/Dockerfile deleted file mode 100644 index 397ce35a2d..0000000000 --- a/8.0-rc/alpine3.15/fpm/Dockerfile +++ /dev/null @@ -1,256 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.15 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-fpm \ - --with-fpm-user=www-data \ - --with-fpm-group=www-data \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -WORKDIR /var/www/html - -RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ - { \ - echo '[global]'; \ - echo 'error_log = /proc/self/fd/2'; \ - echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ - echo; \ - echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ - echo 'access.log = /proc/self/fd/2'; \ - echo; \ - echo 'clear_env = no'; \ - echo; \ - echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ - echo 'catch_workers_output = yes'; \ - echo 'decorate_workers_output = no'; \ - } | tee php-fpm.d/docker.conf; \ - { \ - echo '[global]'; \ - echo 'daemonize = no'; \ - echo; \ - echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf - -# Override stop signal to stop process gracefully -# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 -STOPSIGNAL SIGQUIT - -EXPOSE 9000 -CMD ["php-fpm"] diff --git a/8.0-rc/alpine3.15/fpm/docker-php-ext-install b/8.0-rc/alpine3.15/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/alpine3.15/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/alpine3.15/zts/Dockerfile b/8.0-rc/alpine3.15/zts/Dockerfile deleted file mode 100644 index f5520c153b..0000000000 --- a/8.0-rc/alpine3.15/zts/Dockerfile +++ /dev/null @@ -1,209 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.15 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0-rc/alpine3.15/zts/docker-php-ext-install b/8.0-rc/alpine3.15/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/alpine3.15/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/alpine3.16/cli/docker-php-ext-install b/8.0-rc/alpine3.16/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/alpine3.16/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/alpine3.16/fpm/Dockerfile b/8.0-rc/alpine3.16/fpm/Dockerfile deleted file mode 100644 index a71c1be209..0000000000 --- a/8.0-rc/alpine3.16/fpm/Dockerfile +++ /dev/null @@ -1,256 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.16 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-fpm \ - --with-fpm-user=www-data \ - --with-fpm-group=www-data \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -WORKDIR /var/www/html - -RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ - { \ - echo '[global]'; \ - echo 'error_log = /proc/self/fd/2'; \ - echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ - echo; \ - echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ - echo 'access.log = /proc/self/fd/2'; \ - echo; \ - echo 'clear_env = no'; \ - echo; \ - echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ - echo 'catch_workers_output = yes'; \ - echo 'decorate_workers_output = no'; \ - } | tee php-fpm.d/docker.conf; \ - { \ - echo '[global]'; \ - echo 'daemonize = no'; \ - echo; \ - echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf - -# Override stop signal to stop process gracefully -# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 -STOPSIGNAL SIGQUIT - -EXPOSE 9000 -CMD ["php-fpm"] diff --git a/8.0-rc/alpine3.16/fpm/docker-php-ext-install b/8.0-rc/alpine3.16/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/alpine3.16/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/alpine3.16/zts/Dockerfile b/8.0-rc/alpine3.16/zts/Dockerfile deleted file mode 100644 index ab3393cbc6..0000000000 --- a/8.0-rc/alpine3.16/zts/Dockerfile +++ /dev/null @@ -1,209 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.16 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0-rc/alpine3.16/zts/docker-php-ext-install b/8.0-rc/alpine3.16/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/alpine3.16/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/bullseye/apache/Dockerfile b/8.0-rc/bullseye/apache/Dockerfile deleted file mode 100644 index 63015120dd..0000000000 --- a/8.0-rc/bullseye/apache/Dockerfile +++ /dev/null @@ -1,290 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bullseye-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -ENV APACHE_CONFDIR /etc/apache2 -ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars - -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends apache2; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# generically convert lines like -# export APACHE_RUN_USER=www-data -# into -# : ${APACHE_RUN_USER:=www-data} -# export APACHE_RUN_USER -# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") - sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \ - \ -# setup directories and permissions - . "$APACHE_ENVVARS"; \ - for dir in \ - "$APACHE_LOCK_DIR" \ - "$APACHE_RUN_DIR" \ - "$APACHE_LOG_DIR" \ - ; do \ - rm -rvf "$dir"; \ - mkdir -p "$dir"; \ - chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ - done; \ - \ -# delete the "index.html" that installing Apache drops in here - rm -rvf /var/www/html/*; \ - \ -# logs should go to stdout / stderr - ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ - ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ - ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ - chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" - -# Apache + PHP requires preforking Apache for best results -RUN a2dismod mpm_event && a2enmod mpm_prefork - -# PHP files should be handled by PHP, and should be preferred over any other file type -RUN { \ - echo ''; \ - echo '\tSetHandler application/x-httpd-php'; \ - echo ''; \ - echo; \ - echo 'DirectoryIndex disabled'; \ - echo 'DirectoryIndex index.php index.html'; \ - echo; \ - echo ''; \ - echo '\tOptions -Indexes'; \ - echo '\tAllowOverride All'; \ - echo ''; \ - } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ - && a2enconf docker-php - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - apache2-dev \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ - --with-apxs2 \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop -STOPSIGNAL SIGWINCH - -COPY apache2-foreground /usr/local/bin/ -WORKDIR /var/www/html - -EXPOSE 80 -CMD ["apache2-foreground"] diff --git a/8.0-rc/bullseye/apache/docker-php-ext-install b/8.0-rc/bullseye/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/bullseye/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/bullseye/cli/Dockerfile b/8.0-rc/bullseye/cli/Dockerfile deleted file mode 100644 index 608f63fc86..0000000000 --- a/8.0-rc/bullseye/cli/Dockerfile +++ /dev/null @@ -1,224 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bullseye-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/docker-library/php/pull/1259 - --enable-phpdbg \ - --enable-phpdbg-readline \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0-rc/bullseye/cli/docker-php-ext-install b/8.0-rc/bullseye/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/bullseye/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/bullseye/fpm/Dockerfile b/8.0-rc/bullseye/fpm/Dockerfile deleted file mode 100644 index 77a093fb67..0000000000 --- a/8.0-rc/bullseye/fpm/Dockerfile +++ /dev/null @@ -1,271 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bullseye-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ - --enable-fpm \ - --with-fpm-user=www-data \ - --with-fpm-group=www-data \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -WORKDIR /var/www/html - -RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ - { \ - echo '[global]'; \ - echo 'error_log = /proc/self/fd/2'; \ - echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ - echo; \ - echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ - echo 'access.log = /proc/self/fd/2'; \ - echo; \ - echo 'clear_env = no'; \ - echo; \ - echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ - echo 'catch_workers_output = yes'; \ - echo 'decorate_workers_output = no'; \ - } | tee php-fpm.d/docker.conf; \ - { \ - echo '[global]'; \ - echo 'daemonize = no'; \ - echo; \ - echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf - -# Override stop signal to stop process gracefully -# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 -STOPSIGNAL SIGQUIT - -EXPOSE 9000 -CMD ["php-fpm"] diff --git a/8.0-rc/bullseye/fpm/docker-php-ext-install b/8.0-rc/bullseye/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/bullseye/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/bullseye/zts/Dockerfile b/8.0-rc/bullseye/zts/Dockerfile deleted file mode 100644 index 1442beb2e2..0000000000 --- a/8.0-rc/bullseye/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bullseye-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0-rc/bullseye/zts/docker-php-ext-install b/8.0-rc/bullseye/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/bullseye/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/buster/apache/Dockerfile b/8.0-rc/buster/apache/Dockerfile deleted file mode 100644 index e3ea0cd9b1..0000000000 --- a/8.0-rc/buster/apache/Dockerfile +++ /dev/null @@ -1,290 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:buster-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -ENV APACHE_CONFDIR /etc/apache2 -ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars - -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends apache2; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# generically convert lines like -# export APACHE_RUN_USER=www-data -# into -# : ${APACHE_RUN_USER:=www-data} -# export APACHE_RUN_USER -# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") - sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \ - \ -# setup directories and permissions - . "$APACHE_ENVVARS"; \ - for dir in \ - "$APACHE_LOCK_DIR" \ - "$APACHE_RUN_DIR" \ - "$APACHE_LOG_DIR" \ - ; do \ - rm -rvf "$dir"; \ - mkdir -p "$dir"; \ - chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ - done; \ - \ -# delete the "index.html" that installing Apache drops in here - rm -rvf /var/www/html/*; \ - \ -# logs should go to stdout / stderr - ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ - ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ - ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ - chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" - -# Apache + PHP requires preforking Apache for best results -RUN a2dismod mpm_event && a2enmod mpm_prefork - -# PHP files should be handled by PHP, and should be preferred over any other file type -RUN { \ - echo ''; \ - echo '\tSetHandler application/x-httpd-php'; \ - echo ''; \ - echo; \ - echo 'DirectoryIndex disabled'; \ - echo 'DirectoryIndex index.php index.html'; \ - echo; \ - echo ''; \ - echo '\tOptions -Indexes'; \ - echo '\tAllowOverride All'; \ - echo ''; \ - } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ - && a2enconf docker-php - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - apache2-dev \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ - --with-apxs2 \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop -STOPSIGNAL SIGWINCH - -COPY apache2-foreground /usr/local/bin/ -WORKDIR /var/www/html - -EXPOSE 80 -CMD ["apache2-foreground"] diff --git a/8.0-rc/buster/apache/docker-php-ext-install b/8.0-rc/buster/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/buster/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/buster/cli/docker-php-ext-install b/8.0-rc/buster/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/buster/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/buster/fpm/Dockerfile b/8.0-rc/buster/fpm/Dockerfile deleted file mode 100644 index e1d3df23fd..0000000000 --- a/8.0-rc/buster/fpm/Dockerfile +++ /dev/null @@ -1,271 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:buster-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ - --enable-fpm \ - --with-fpm-user=www-data \ - --with-fpm-group=www-data \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -WORKDIR /var/www/html - -RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ - { \ - echo '[global]'; \ - echo 'error_log = /proc/self/fd/2'; \ - echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ - echo; \ - echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ - echo 'access.log = /proc/self/fd/2'; \ - echo; \ - echo 'clear_env = no'; \ - echo; \ - echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ - echo 'catch_workers_output = yes'; \ - echo 'decorate_workers_output = no'; \ - } | tee php-fpm.d/docker.conf; \ - { \ - echo '[global]'; \ - echo 'daemonize = no'; \ - echo; \ - echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf - -# Override stop signal to stop process gracefully -# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 -STOPSIGNAL SIGQUIT - -EXPOSE 9000 -CMD ["php-fpm"] diff --git a/8.0-rc/buster/fpm/docker-php-ext-install b/8.0-rc/buster/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/buster/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0-rc/buster/zts/Dockerfile b/8.0-rc/buster/zts/Dockerfile deleted file mode 100644 index 36b908352a..0000000000 --- a/8.0-rc/buster/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:buster-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0-rc/buster/zts/docker-php-ext-install b/8.0-rc/buster/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0-rc/buster/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/alpine3.15/cli/docker-php-ext-install b/8.0/alpine3.15/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/alpine3.15/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/alpine3.15/fpm/docker-php-ext-install b/8.0/alpine3.15/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/alpine3.15/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/alpine3.15/zts/Dockerfile b/8.0/alpine3.15/zts/Dockerfile deleted file mode 100644 index fcb03c6bfe..0000000000 --- a/8.0/alpine3.15/zts/Dockerfile +++ /dev/null @@ -1,209 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.15 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0/alpine3.15/zts/docker-php-ext-install b/8.0/alpine3.15/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/alpine3.15/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/alpine3.16/cli/docker-php-ext-install b/8.0/alpine3.16/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/alpine3.16/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/alpine3.16/fpm/docker-php-ext-install b/8.0/alpine3.16/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/alpine3.16/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/alpine3.16/zts/Dockerfile b/8.0/alpine3.16/zts/Dockerfile deleted file mode 100644 index f70ddaaf6c..0000000000 --- a/8.0/alpine3.16/zts/Dockerfile +++ /dev/null @@ -1,209 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.16 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0/alpine3.16/zts/docker-php-ext-install b/8.0/alpine3.16/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/alpine3.16/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/bullseye/apache/docker-php-ext-install b/8.0/bullseye/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/bullseye/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/bullseye/cli/docker-php-ext-install b/8.0/bullseye/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/bullseye/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/bullseye/fpm/docker-php-ext-install b/8.0/bullseye/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/bullseye/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/bullseye/zts/Dockerfile b/8.0/bullseye/zts/Dockerfile deleted file mode 100644 index 16947d0c6a..0000000000 --- a/8.0/bullseye/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bullseye-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0/bullseye/zts/docker-php-ext-install b/8.0/bullseye/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/bullseye/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/buster/apache/docker-php-ext-install b/8.0/buster/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/buster/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/buster/cli/docker-php-ext-install b/8.0/buster/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/buster/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/buster/fpm/docker-php-ext-install b/8.0/buster/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/buster/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.0/buster/zts/Dockerfile b/8.0/buster/zts/Dockerfile deleted file mode 100644 index f3df2075f0..0000000000 --- a/8.0/buster/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:buster-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F - -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.0/buster/zts/docker-php-ext-install b/8.0/buster/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.0/buster/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/alpine3.15/cli/Dockerfile b/8.1/alpine3.15/cli/Dockerfile deleted file mode 100644 index eac0530f65..0000000000 --- a/8.1/alpine3.15/cli/Dockerfile +++ /dev/null @@ -1,206 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.15 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD - -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/docker-library/php/pull/1259 - --enable-phpdbg \ - --enable-phpdbg-readline \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.1/alpine3.15/cli/docker-php-ext-install b/8.1/alpine3.15/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/alpine3.15/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/alpine3.15/fpm/docker-php-ext-install b/8.1/alpine3.15/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/alpine3.15/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/alpine3.15/zts/Dockerfile b/8.1/alpine3.15/zts/Dockerfile deleted file mode 100644 index 03c580a289..0000000000 --- a/8.1/alpine3.15/zts/Dockerfile +++ /dev/null @@ -1,209 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.15 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD - -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.1/alpine3.15/zts/docker-php-ext-install b/8.1/alpine3.15/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/alpine3.15/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/alpine3.16/cli/Dockerfile b/8.1/alpine3.16/cli/Dockerfile deleted file mode 100644 index 6836d109aa..0000000000 --- a/8.1/alpine3.16/cli/Dockerfile +++ /dev/null @@ -1,206 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.16 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD - -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/docker-library/php/pull/1259 - --enable-phpdbg \ - --enable-phpdbg-readline \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.1/alpine3.16/cli/docker-php-ext-install b/8.1/alpine3.16/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/alpine3.16/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/alpine3.16/fpm/docker-php-ext-install b/8.1/alpine3.16/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/alpine3.16/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/alpine3.16/zts/Dockerfile b/8.1/alpine3.16/zts/Dockerfile deleted file mode 100644 index 5116eb0f93..0000000000 --- a/8.1/alpine3.16/zts/Dockerfile +++ /dev/null @@ -1,209 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.16 - -# dependencies required for running "phpize" -# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev dpkg \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkgconf \ - re2c - -# persistent / runtime deps -RUN apk add --no-cache \ - ca-certificates \ - curl \ - tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl - -# ensure www-data user exists -RUN set -eux; \ - adduser -u 82 -D -S -G www-data www-data -# 82 is the standard uid/gid for "www-data" in Alpine -# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable -# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD - -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apk del --no-network .fetch-deps - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev \ - ; \ - \ -# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) - rm -vf /usr/include/iconv.h; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv=/usr \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ - \ - --disable-cgi \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache $runDeps; \ - \ - apk del --no-network .build-deps; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.1/alpine3.16/zts/docker-php-ext-install b/8.1/alpine3.16/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/alpine3.16/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/bullseye/apache/docker-php-ext-install b/8.1/bullseye/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/bullseye/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/bullseye/cli/docker-php-ext-install b/8.1/bullseye/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/bullseye/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/bullseye/fpm/docker-php-ext-install b/8.1/bullseye/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/bullseye/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/bullseye/zts/Dockerfile b/8.1/bullseye/zts/Dockerfile deleted file mode 100644 index 2bcc5a1a24..0000000000 --- a/8.1/bullseye/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bullseye-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD - -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.1/bullseye/zts/docker-php-ext-install b/8.1/bullseye/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/bullseye/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/buster/apache/docker-php-ext-install b/8.1/buster/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/buster/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/buster/cli/docker-php-ext-install b/8.1/buster/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/buster/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/buster/fpm/docker-php-ext-install b/8.1/buster/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/buster/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.1/buster/zts/Dockerfile b/8.1/buster/zts/Dockerfile deleted file mode 100644 index c07037992a..0000000000 --- a/8.1/buster/zts/Dockerfile +++ /dev/null @@ -1,227 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:buster-slim - -# prevent Debian's PHP packages from being installed -# https://github.com/docker-library/php/pull/542 -RUN set -eux; \ - { \ - echo 'Package: php*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-php - -# dependencies required for running "phpize" -# (see persistent deps below) -ENV PHPIZE_DEPS \ - autoconf \ - dpkg-dev \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config \ - re2c - -# persistent / runtime deps -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - $PHPIZE_DEPS \ - ca-certificates \ - curl \ - xz-utils \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV PHP_INI_DIR /usr/local/etc/php -RUN set -eux; \ - mkdir -p "$PHP_INI_DIR/conf.d"; \ -# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - [ ! -d /var/www/html ]; \ - mkdir -p /var/www/html; \ - chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html - -# Apply stack smash protection to functions using local buffers and alloca() -# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) -# Enable optimization (-O2) -# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) -# https://github.com/docker-library/php/issues/272 -# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) -ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -ENV PHP_CPPFLAGS="$PHP_CFLAGS" -ENV PHP_LDFLAGS="-Wl,-O1 -pie" - -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD - -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ - \ - mkdir -p /usr/src; \ - cd /usr/src; \ - \ - curl -fsSL -o php.tar.xz "$PHP_URL"; \ - \ - if [ -n "$PHP_SHA256" ]; then \ - echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ - fi; \ - \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - -COPY docker-php-source /usr/local/bin/ - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libargon2-dev \ - libcurl4-openssl-dev \ - libonig-dev \ - libreadline-dev \ - libsodium-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - zlib1g-dev \ - ; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - ; \ - docker-php-source extract; \ - cd /usr/src/php; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ -# https://bugs.php.net/bug.php?id=74125 - if [ ! -d /usr/include/curl ]; then \ - ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ - fi; \ - ./configure \ - --build="$gnuArch" \ - --with-config-file-path="$PHP_INI_DIR" \ - --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ - \ -# make sure invalid --configure-flags are fatal errors instead of just warnings - --enable-option-checking=fatal \ - \ -# https://github.com/docker-library/php/issues/439 - --with-mhash \ - \ -# https://github.com/docker-library/php/issues/822 - --with-pic \ - \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ -# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) - --enable-mbstring \ -# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) - --enable-mysqlnd \ -# https://wiki.php.net/rfc/argon2_password_hash - --with-password-argon2 \ -# https://wiki.php.net/rfc/libsodium - --with-sodium=shared \ -# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) - --with-pdo-sqlite=/usr \ - --with-sqlite3=/usr \ - \ - --with-curl \ - --with-iconv \ - --with-openssl \ - --with-readline \ - --with-zlib \ - \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ - \ -# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") - --with-pear \ - \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ - --with-libdir="lib/$debMultiarch" \ - \ - --disable-cgi \ - \ -# https://github.com/docker-library/php/pull/939#issuecomment-730501748 - --enable-embed \ - \ - --enable-zts \ - ; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install; \ - find \ - /usr/local \ - -type f \ - -perm '/0111' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : \ - ' -- '{}' + \ - ; \ - make clean; \ - \ -# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) - cp -v php.ini-* "$PHP_INI_DIR/"; \ - \ - cd /; \ - docker-php-source delete; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# update pecl channel definitions https://github.com/docker-library/php/issues/443 - pecl update-channels; \ - rm -rf /tmp/pear ~/.pearrc; \ - \ -# smoke test - php --version - -COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ - -# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) -RUN docker-php-ext-enable sodium - -ENTRYPOINT ["docker-php-entrypoint"] -CMD ["php", "-a"] diff --git a/8.1/buster/zts/docker-php-ext-install b/8.1/buster/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.1/buster/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/alpine3.15/cli/docker-php-entrypoint b/8.2-rc/alpine3.15/cli/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/alpine3.15/cli/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/alpine3.15/cli/docker-php-ext-configure b/8.2-rc/alpine3.15/cli/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/alpine3.15/cli/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/alpine3.15/cli/docker-php-ext-enable b/8.2-rc/alpine3.15/cli/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/alpine3.15/cli/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/alpine3.15/cli/docker-php-ext-install b/8.2-rc/alpine3.15/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/alpine3.15/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/alpine3.15/cli/docker-php-source b/8.2-rc/alpine3.15/cli/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/alpine3.15/cli/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/alpine3.15/fpm/docker-php-entrypoint b/8.2-rc/alpine3.15/fpm/docker-php-entrypoint deleted file mode 100755 index 86343d8038..0000000000 --- a/8.2-rc/alpine3.15/fpm/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php-fpm "$@" -fi - -exec "$@" diff --git a/8.2-rc/alpine3.15/fpm/docker-php-ext-configure b/8.2-rc/alpine3.15/fpm/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/alpine3.15/fpm/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/alpine3.15/fpm/docker-php-ext-enable b/8.2-rc/alpine3.15/fpm/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/alpine3.15/fpm/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/alpine3.15/fpm/docker-php-ext-install b/8.2-rc/alpine3.15/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/alpine3.15/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/alpine3.15/fpm/docker-php-source b/8.2-rc/alpine3.15/fpm/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/alpine3.15/fpm/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/alpine3.15/zts/docker-php-entrypoint b/8.2-rc/alpine3.15/zts/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/alpine3.15/zts/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/alpine3.15/zts/docker-php-ext-configure b/8.2-rc/alpine3.15/zts/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/alpine3.15/zts/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/alpine3.15/zts/docker-php-ext-enable b/8.2-rc/alpine3.15/zts/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/alpine3.15/zts/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/alpine3.15/zts/docker-php-ext-install b/8.2-rc/alpine3.15/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/alpine3.15/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/alpine3.15/zts/docker-php-source b/8.2-rc/alpine3.15/zts/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/alpine3.15/zts/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/alpine3.16/cli/docker-php-entrypoint b/8.2-rc/alpine3.16/cli/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/alpine3.16/cli/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/alpine3.16/cli/docker-php-ext-configure b/8.2-rc/alpine3.16/cli/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/alpine3.16/cli/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/alpine3.16/cli/docker-php-ext-enable b/8.2-rc/alpine3.16/cli/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/alpine3.16/cli/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/alpine3.16/cli/docker-php-ext-install b/8.2-rc/alpine3.16/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/alpine3.16/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/alpine3.16/cli/docker-php-source b/8.2-rc/alpine3.16/cli/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/alpine3.16/cli/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/alpine3.16/fpm/docker-php-entrypoint b/8.2-rc/alpine3.16/fpm/docker-php-entrypoint deleted file mode 100755 index 86343d8038..0000000000 --- a/8.2-rc/alpine3.16/fpm/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php-fpm "$@" -fi - -exec "$@" diff --git a/8.2-rc/alpine3.16/fpm/docker-php-ext-configure b/8.2-rc/alpine3.16/fpm/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/alpine3.16/fpm/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/alpine3.16/fpm/docker-php-ext-enable b/8.2-rc/alpine3.16/fpm/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/alpine3.16/fpm/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/alpine3.16/fpm/docker-php-ext-install b/8.2-rc/alpine3.16/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/alpine3.16/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/alpine3.16/fpm/docker-php-source b/8.2-rc/alpine3.16/fpm/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/alpine3.16/fpm/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/alpine3.16/zts/docker-php-entrypoint b/8.2-rc/alpine3.16/zts/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/alpine3.16/zts/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/alpine3.16/zts/docker-php-ext-configure b/8.2-rc/alpine3.16/zts/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/alpine3.16/zts/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/alpine3.16/zts/docker-php-ext-enable b/8.2-rc/alpine3.16/zts/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/alpine3.16/zts/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/alpine3.16/zts/docker-php-ext-install b/8.2-rc/alpine3.16/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/alpine3.16/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/alpine3.16/zts/docker-php-source b/8.2-rc/alpine3.16/zts/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/alpine3.16/zts/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/bullseye/apache/apache2-foreground b/8.2-rc/bullseye/apache/apache2-foreground deleted file mode 100755 index 5fe22e26f7..0000000000 --- a/8.2-rc/bullseye/apache/apache2-foreground +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -set -e - -# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background. -# (also, when run as "apache2ctl ", it does not use "exec", which leaves an undesirable resident shell process) - -: "${APACHE_CONFDIR:=/etc/apache2}" -: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}" -if test -f "$APACHE_ENVVARS"; then - . "$APACHE_ENVVARS" -fi - -# Apache gets grumpy about PID files pre-existing -: "${APACHE_RUN_DIR:=/var/run/apache2}" -: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}" -rm -f "$APACHE_PID_FILE" - -# create missing directories -# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR) -for e in "${!APACHE_@}"; do - if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then - # handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir - # mkdir: cannot create directory '/var/lock': File exists - dir="${!e}" - while [ "$dir" != "$(dirname "$dir")" ]; do - dir="$(dirname "$dir")" - if [ -d "$dir" ]; then - break - fi - absDir="$(readlink -f "$dir" 2>/dev/null || :)" - if [ -n "$absDir" ]; then - mkdir -p "$absDir" - fi - done - - mkdir -p "${!e}" - fi -done - -exec apache2 -DFOREGROUND "$@" diff --git a/8.2-rc/bullseye/apache/docker-php-entrypoint b/8.2-rc/bullseye/apache/docker-php-entrypoint deleted file mode 100755 index 3d36d5e8cf..0000000000 --- a/8.2-rc/bullseye/apache/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- apache2-foreground "$@" -fi - -exec "$@" diff --git a/8.2-rc/bullseye/apache/docker-php-ext-configure b/8.2-rc/bullseye/apache/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/bullseye/apache/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/bullseye/apache/docker-php-ext-enable b/8.2-rc/bullseye/apache/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/bullseye/apache/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/bullseye/apache/docker-php-ext-install b/8.2-rc/bullseye/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/bullseye/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/bullseye/apache/docker-php-source b/8.2-rc/bullseye/apache/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/bullseye/apache/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/bullseye/cli/docker-php-entrypoint b/8.2-rc/bullseye/cli/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/bullseye/cli/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/bullseye/cli/docker-php-ext-configure b/8.2-rc/bullseye/cli/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/bullseye/cli/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/bullseye/cli/docker-php-ext-enable b/8.2-rc/bullseye/cli/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/bullseye/cli/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/bullseye/cli/docker-php-ext-install b/8.2-rc/bullseye/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/bullseye/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/bullseye/cli/docker-php-source b/8.2-rc/bullseye/cli/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/bullseye/cli/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/bullseye/fpm/docker-php-entrypoint b/8.2-rc/bullseye/fpm/docker-php-entrypoint deleted file mode 100755 index 86343d8038..0000000000 --- a/8.2-rc/bullseye/fpm/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php-fpm "$@" -fi - -exec "$@" diff --git a/8.2-rc/bullseye/fpm/docker-php-ext-configure b/8.2-rc/bullseye/fpm/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/bullseye/fpm/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/bullseye/fpm/docker-php-ext-enable b/8.2-rc/bullseye/fpm/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/bullseye/fpm/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/bullseye/fpm/docker-php-ext-install b/8.2-rc/bullseye/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/bullseye/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/bullseye/fpm/docker-php-source b/8.2-rc/bullseye/fpm/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/bullseye/fpm/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/bullseye/zts/docker-php-entrypoint b/8.2-rc/bullseye/zts/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/bullseye/zts/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/bullseye/zts/docker-php-ext-configure b/8.2-rc/bullseye/zts/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/bullseye/zts/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/bullseye/zts/docker-php-ext-enable b/8.2-rc/bullseye/zts/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/bullseye/zts/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/bullseye/zts/docker-php-ext-install b/8.2-rc/bullseye/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/bullseye/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/bullseye/zts/docker-php-source b/8.2-rc/bullseye/zts/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/bullseye/zts/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/buster/apache/apache2-foreground b/8.2-rc/buster/apache/apache2-foreground deleted file mode 100755 index 5fe22e26f7..0000000000 --- a/8.2-rc/buster/apache/apache2-foreground +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -set -e - -# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background. -# (also, when run as "apache2ctl ", it does not use "exec", which leaves an undesirable resident shell process) - -: "${APACHE_CONFDIR:=/etc/apache2}" -: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}" -if test -f "$APACHE_ENVVARS"; then - . "$APACHE_ENVVARS" -fi - -# Apache gets grumpy about PID files pre-existing -: "${APACHE_RUN_DIR:=/var/run/apache2}" -: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}" -rm -f "$APACHE_PID_FILE" - -# create missing directories -# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR) -for e in "${!APACHE_@}"; do - if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then - # handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir - # mkdir: cannot create directory '/var/lock': File exists - dir="${!e}" - while [ "$dir" != "$(dirname "$dir")" ]; do - dir="$(dirname "$dir")" - if [ -d "$dir" ]; then - break - fi - absDir="$(readlink -f "$dir" 2>/dev/null || :)" - if [ -n "$absDir" ]; then - mkdir -p "$absDir" - fi - done - - mkdir -p "${!e}" - fi -done - -exec apache2 -DFOREGROUND "$@" diff --git a/8.2-rc/buster/apache/docker-php-entrypoint b/8.2-rc/buster/apache/docker-php-entrypoint deleted file mode 100755 index 3d36d5e8cf..0000000000 --- a/8.2-rc/buster/apache/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- apache2-foreground "$@" -fi - -exec "$@" diff --git a/8.2-rc/buster/apache/docker-php-ext-configure b/8.2-rc/buster/apache/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/buster/apache/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/buster/apache/docker-php-ext-enable b/8.2-rc/buster/apache/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/buster/apache/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/buster/apache/docker-php-ext-install b/8.2-rc/buster/apache/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/buster/apache/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/buster/apache/docker-php-source b/8.2-rc/buster/apache/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/buster/apache/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/buster/cli/docker-php-entrypoint b/8.2-rc/buster/cli/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/buster/cli/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/buster/cli/docker-php-ext-configure b/8.2-rc/buster/cli/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/buster/cli/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/buster/cli/docker-php-ext-enable b/8.2-rc/buster/cli/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/buster/cli/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/buster/cli/docker-php-ext-install b/8.2-rc/buster/cli/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/buster/cli/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/buster/cli/docker-php-source b/8.2-rc/buster/cli/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/buster/cli/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/buster/fpm/docker-php-entrypoint b/8.2-rc/buster/fpm/docker-php-entrypoint deleted file mode 100755 index 86343d8038..0000000000 --- a/8.2-rc/buster/fpm/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php-fpm "$@" -fi - -exec "$@" diff --git a/8.2-rc/buster/fpm/docker-php-ext-configure b/8.2-rc/buster/fpm/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/buster/fpm/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/buster/fpm/docker-php-ext-enable b/8.2-rc/buster/fpm/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/buster/fpm/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/buster/fpm/docker-php-ext-install b/8.2-rc/buster/fpm/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/buster/fpm/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/buster/fpm/docker-php-source b/8.2-rc/buster/fpm/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/buster/fpm/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/buster/zts/docker-php-entrypoint b/8.2-rc/buster/zts/docker-php-entrypoint deleted file mode 100755 index 88a016c16c..0000000000 --- a/8.2-rc/buster/zts/docker-php-entrypoint +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- php "$@" -fi - -exec "$@" diff --git a/8.2-rc/buster/zts/docker-php-ext-configure b/8.2-rc/buster/zts/docker-php-ext-configure deleted file mode 100755 index 34fc1337d5..0000000000 --- a/8.2-rc/buster/zts/docker-php-ext-configure +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 ext-name [configure flags]" - echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -ext="$1" -if [ -z "$ext" ] || [ ! -d "$ext" ]; then - usage >&2 - exit 1 -fi -shift - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS - fi -fi - -if command -v dpkg-architecture > /dev/null; then - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" - set -- --build="$gnuArch" "$@" -fi - -cd "$ext" -phpize -./configure --enable-option-checking=fatal "$@" diff --git a/8.2-rc/buster/zts/docker-php-ext-enable b/8.2-rc/buster/zts/docker-php-ext-enable deleted file mode 100755 index 41d20bbe3f..0000000000 --- a/8.2-rc/buster/zts/docker-php-ext-enable +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -set -e - -extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" -cd "$extDir" - -usage() { - echo "usage: $0 [options] module-name [module-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 --ini-name 0-apc.ini apcu apc" - echo - echo 'Possible values for module-name:' - find -maxdepth 1 \ - -type f \ - -name '*.so' \ - -exec basename '{}' ';' \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -modules= -for module; do - if [ -z "$module" ]; then - continue - fi - if ! [ -f "$module" ] && ! [ -f "$module.so" ]; then - echo >&2 "error: '$module' does not exist" - echo >&2 - usage >&2 - exit 1 - fi - modules="$modules $module" -done - -if [ -z "$modules" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if \ - [ -n "$PHPIZE_DEPS" ] \ - && ! apk info --installed .phpize-deps > /dev/null \ - && ! apk info --installed .phpize-deps-configure > /dev/null \ - ; then - apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils - apkDel='.docker-php-ext-enable-deps' - fi -fi - -for module in $modules; do - moduleFile="$module" - if [ -f "$module.so" ] && ! [ -f "$module" ]; then - moduleFile="$module.so" - fi - if readelf --wide --syms "$moduleFile" | grep -q ' zend_extension_entry$'; then - # https://wiki.php.net/internals/extensions#loading_zend_extensions - line="zend_extension=$module" - else - line="extension=$module" - fi - - ext="$(basename "$module")" - ext="${ext%.*}" - if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then - # this isn't perfect, but it's better than nothing - # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') - echo >&2 - echo >&2 "warning: $ext ($module) is already loaded!" - echo >&2 - continue - fi - - case "$iniName" in - /*) - # allow an absolute path - ini="$iniName" - ;; - *) - ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" - ;; - esac - if ! grep -qFx -e "$line" -e "$line.so" "$ini" 2>/dev/null; then - echo "$line" >> "$ini" - fi -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi diff --git a/8.2-rc/buster/zts/docker-php-ext-install b/8.2-rc/buster/zts/docker-php-ext-install deleted file mode 100755 index aa0b96c5a3..0000000000 --- a/8.2-rc/buster/zts/docker-php-ext-install +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -set -e - -# prefer user supplied CFLAGS, but default to our PHP_CFLAGS -: ${CFLAGS:=$PHP_CFLAGS} -: ${CPPFLAGS:=$PHP_CPPFLAGS} -: ${LDFLAGS:=$PHP_LDFLAGS} -export CFLAGS CPPFLAGS LDFLAGS - -srcExists= -if [ -d /usr/src/php ]; then - srcExists=1 -fi -docker-php-source extract -if [ -z "$srcExists" ]; then - touch /usr/src/php/.docker-delete-me -fi - -cd /usr/src/php/ext - -usage() { - echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" - echo " ie: $0 gd mysqli" - echo " $0 pdo pdo_mysql" - echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" - echo - echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' - echo - echo 'Possible values for ext-name:' - find . \ - -mindepth 2 \ - -maxdepth 2 \ - -type f \ - -name 'config.m4' \ - | xargs -n1 dirname \ - | xargs -n1 basename \ - | sort \ - | xargs - echo - echo 'Some of the above modules are already compiled into PHP; please check' - echo 'the output of "php -i" to see which modules are already loaded.' -} - -opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" -eval set -- "$opts" - -j=1 -iniName= -while true; do - flag="$1" - shift - case "$flag" in - --help|-h|'-?') usage && exit 0 ;; - --ini-name) iniName="$1" && shift ;; - --jobs|-j) j="$1" && shift ;; - --) break ;; - *) - { - echo "error: unknown flag: $flag" - usage - } >&2 - exit 1 - ;; - esac -done - -exts= -for ext; do - if [ -z "$ext" ]; then - continue - fi - if [ ! -d "$ext" ]; then - echo >&2 "error: $PWD/$ext does not exist" - echo >&2 - usage >&2 - exit 1 - fi - exts="$exts $ext" -done - -if [ -z "$exts" ]; then - usage >&2 - exit 1 -fi - -pm='unknown' -if [ -e /lib/apk/db/installed ]; then - pm='apk' -fi - -apkDel= -if [ "$pm" = 'apk' ]; then - if [ -n "$PHPIZE_DEPS" ]; then - if apk info --installed .phpize-deps-configure > /dev/null; then - apkDel='.phpize-deps-configure' - elif ! apk info --installed .phpize-deps > /dev/null; then - apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS - apkDel='.phpize-deps' - fi - fi -fi - -popDir="$PWD" -for ext in $exts; do - cd "$ext" - - [ -e Makefile ] || docker-php-ext-configure "$ext" - - make -j"$j" - - if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then - # only "strip" modules if we aren't using a debug build of PHP - # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) - # https://github.com/docker-library/php/issues/1268 - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec sh -euxc ' \ - strip --strip-all "$@" || : - ' -- '{}' + - fi - - make -j"$j" install - - find modules \ - -maxdepth 1 \ - -name '*.so' \ - -exec basename '{}' ';' \ - | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} - - make -j"$j" clean - - cd "$popDir" -done - -if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then - apk del --no-network $apkDel -fi - -if [ -e /usr/src/php/.docker-delete-me ]; then - docker-php-source delete -fi diff --git a/8.2-rc/buster/zts/docker-php-source b/8.2-rc/buster/zts/docker-php-source deleted file mode 100755 index 9033d243de..0000000000 --- a/8.2-rc/buster/zts/docker-php-source +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -e - -dir=/usr/src/php - -usage() { - echo "usage: $0 COMMAND" - echo - echo "Manage php source tarball lifecycle." - echo - echo "Commands:" - echo " extract extract php source tarball into directory $dir if not already done." - echo " delete delete extracted php source located into $dir if not already done." - echo -} - -case "$1" in - extract) - mkdir -p "$dir" - if [ ! -f "$dir/.docker-extracted" ]; then - tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 - touch "$dir/.docker-extracted" - fi - ;; - - delete) - rm -rf "$dir" - ;; - - *) - usage - exit 1 - ;; -esac diff --git a/8.2-rc/alpine3.15/cli/Dockerfile b/8.2/alpine3.22/cli/Dockerfile similarity index 80% rename from 8.2-rc/alpine3.15/cli/Dockerfile rename to 8.2/alpine3.22/cli/Dockerfile index 69089377fd..06e1b11352 100644 --- a/8.2-rc/alpine3.15/cli/Dockerfile +++ b/8.2/alpine3.22/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -57,9 +56,9 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -157,9 +157,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-musl' && echo '--without-pcre-jit') \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -199,6 +200,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/alpine3.15/cli/docker-php-entrypoint b/8.2/alpine3.22/cli/docker-php-entrypoint similarity index 100% rename from 7.4/alpine3.15/cli/docker-php-entrypoint rename to 8.2/alpine3.22/cli/docker-php-entrypoint diff --git a/7.4/alpine3.15/cli/docker-php-ext-configure b/8.2/alpine3.22/cli/docker-php-ext-configure similarity index 100% rename from 7.4/alpine3.15/cli/docker-php-ext-configure rename to 8.2/alpine3.22/cli/docker-php-ext-configure diff --git a/7.4/alpine3.15/cli/docker-php-ext-enable b/8.2/alpine3.22/cli/docker-php-ext-enable similarity index 100% rename from 7.4/alpine3.15/cli/docker-php-ext-enable rename to 8.2/alpine3.22/cli/docker-php-ext-enable diff --git a/7.4/alpine3.15/zts/docker-php-ext-install b/8.2/alpine3.22/cli/docker-php-ext-install similarity index 98% rename from 7.4/alpine3.15/zts/docker-php-ext-install rename to 8.2/alpine3.22/cli/docker-php-ext-install index aa0b96c5a3..fbf44849c0 100755 --- a/7.4/alpine3.15/zts/docker-php-ext-install +++ b/8.2/alpine3.22/cli/docker-php-ext-install @@ -126,7 +126,7 @@ for ext in $exts; do find modules \ -maxdepth 1 \ -name '*.so' \ - -exec basename '{}' ';' \ + -exec basename '{}' '.so' ';' \ | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} make -j"$j" clean diff --git a/7.4/alpine3.15/cli/docker-php-source b/8.2/alpine3.22/cli/docker-php-source similarity index 100% rename from 7.4/alpine3.15/cli/docker-php-source rename to 8.2/alpine3.22/cli/docker-php-source diff --git a/8.2-rc/alpine3.15/fpm/Dockerfile b/8.2/alpine3.22/fpm/Dockerfile similarity index 78% rename from 8.2-rc/alpine3.15/fpm/Dockerfile rename to 8.2/alpine3.22/fpm/Dockerfile index 4142c13fd8..eb88470874 100644 --- a/8.2-rc/alpine3.15/fpm/Dockerfile +++ b/8.2/alpine3.22/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -57,9 +56,9 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -156,9 +156,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -204,6 +205,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -211,27 +215,19 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -246,7 +242,12 @@ RUN set -eux; \ echo; \ echo '[www]'; \ echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/7.4/alpine3.15/fpm/docker-php-entrypoint b/8.2/alpine3.22/fpm/docker-php-entrypoint similarity index 100% rename from 7.4/alpine3.15/fpm/docker-php-entrypoint rename to 8.2/alpine3.22/fpm/docker-php-entrypoint diff --git a/7.4/alpine3.15/fpm/docker-php-ext-configure b/8.2/alpine3.22/fpm/docker-php-ext-configure similarity index 100% rename from 7.4/alpine3.15/fpm/docker-php-ext-configure rename to 8.2/alpine3.22/fpm/docker-php-ext-configure diff --git a/7.4/alpine3.15/fpm/docker-php-ext-enable b/8.2/alpine3.22/fpm/docker-php-ext-enable similarity index 100% rename from 7.4/alpine3.15/fpm/docker-php-ext-enable rename to 8.2/alpine3.22/fpm/docker-php-ext-enable diff --git a/7.4/alpine3.15/cli/docker-php-ext-install b/8.2/alpine3.22/fpm/docker-php-ext-install similarity index 98% rename from 7.4/alpine3.15/cli/docker-php-ext-install rename to 8.2/alpine3.22/fpm/docker-php-ext-install index aa0b96c5a3..fbf44849c0 100755 --- a/7.4/alpine3.15/cli/docker-php-ext-install +++ b/8.2/alpine3.22/fpm/docker-php-ext-install @@ -126,7 +126,7 @@ for ext in $exts; do find modules \ -maxdepth 1 \ -name '*.so' \ - -exec basename '{}' ';' \ + -exec basename '{}' '.so' ';' \ | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} make -j"$j" clean diff --git a/7.4/alpine3.15/fpm/docker-php-source b/8.2/alpine3.22/fpm/docker-php-source similarity index 100% rename from 7.4/alpine3.15/fpm/docker-php-source rename to 8.2/alpine3.22/fpm/docker-php-source diff --git a/8.2-rc/alpine3.15/zts/Dockerfile b/8.2/alpine3.22/zts/Dockerfile similarity index 72% rename from 8.2-rc/alpine3.15/zts/Dockerfile rename to 8.2/alpine3.22/zts/Dockerfile index da411880f0..8047698bd9 100644 --- a/8.2-rc/alpine3.15/zts/Dockerfile +++ b/8.2/alpine3.22/zts/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -57,9 +56,9 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -101,6 +98,8 @@ RUN set -eux; \ linux-headers \ oniguruma-dev \ openssl-dev \ + patch \ + patchutils \ readline-dev \ sqlite-dev \ ; \ @@ -112,12 +111,23 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ + # https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c" + # https://github.com/docker-library/php/pull/1580 + curl -fL 'https://github.com/php/php-src/commit/b3c8afe272a6919248986c703c2e1defc73ff707.patch?full_index=1' -o 18743.patch; \ + echo 'b334f73434c9732a4b27a42eb5d417e10df842e854c02a3e753b2479f8978bf5 *18743.patch' | sha256sum -c -; \ + filterdiff -x '*/NEWS' 18743.patch | patch -p1; \ + rm 18743.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +140,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -150,19 +158,25 @@ RUN set -eux; \ --with-readline \ --with-zlib \ \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-musl' && echo '--without-pcre-jit') \ \ - --disable-cgi \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ \ --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + --enable-zend-max-execution-timers \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -202,6 +216,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/alpine3.15/zts/docker-php-entrypoint b/8.2/alpine3.22/zts/docker-php-entrypoint similarity index 100% rename from 7.4/alpine3.15/zts/docker-php-entrypoint rename to 8.2/alpine3.22/zts/docker-php-entrypoint diff --git a/7.4/alpine3.15/zts/docker-php-ext-configure b/8.2/alpine3.22/zts/docker-php-ext-configure similarity index 100% rename from 7.4/alpine3.15/zts/docker-php-ext-configure rename to 8.2/alpine3.22/zts/docker-php-ext-configure diff --git a/7.4/alpine3.15/zts/docker-php-ext-enable b/8.2/alpine3.22/zts/docker-php-ext-enable similarity index 100% rename from 7.4/alpine3.15/zts/docker-php-ext-enable rename to 8.2/alpine3.22/zts/docker-php-ext-enable diff --git a/7.4/alpine3.16/cli/docker-php-ext-install b/8.2/alpine3.22/zts/docker-php-ext-install similarity index 98% rename from 7.4/alpine3.16/cli/docker-php-ext-install rename to 8.2/alpine3.22/zts/docker-php-ext-install index aa0b96c5a3..fbf44849c0 100755 --- a/7.4/alpine3.16/cli/docker-php-ext-install +++ b/8.2/alpine3.22/zts/docker-php-ext-install @@ -126,7 +126,7 @@ for ext in $exts; do find modules \ -maxdepth 1 \ -name '*.so' \ - -exec basename '{}' ';' \ + -exec basename '{}' '.so' ';' \ | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} make -j"$j" clean diff --git a/7.4/alpine3.15/zts/docker-php-source b/8.2/alpine3.22/zts/docker-php-source similarity index 100% rename from 7.4/alpine3.15/zts/docker-php-source rename to 8.2/alpine3.22/zts/docker-php-source diff --git a/8.2-rc/alpine3.16/cli/Dockerfile b/8.2/alpine3.23/cli/Dockerfile similarity index 80% rename from 8.2-rc/alpine3.16/cli/Dockerfile rename to 8.2/alpine3.23/cli/Dockerfile index 3f4b0980d5..472ec20956 100644 --- a/8.2-rc/alpine3.16/cli/Dockerfile +++ b/8.2/alpine3.23/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -57,9 +56,9 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -157,9 +157,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-musl' && echo '--without-pcre-jit') \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -199,6 +200,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/alpine3.16/cli/docker-php-entrypoint b/8.2/alpine3.23/cli/docker-php-entrypoint similarity index 100% rename from 7.4/alpine3.16/cli/docker-php-entrypoint rename to 8.2/alpine3.23/cli/docker-php-entrypoint diff --git a/7.4/alpine3.16/cli/docker-php-ext-configure b/8.2/alpine3.23/cli/docker-php-ext-configure similarity index 100% rename from 7.4/alpine3.16/cli/docker-php-ext-configure rename to 8.2/alpine3.23/cli/docker-php-ext-configure diff --git a/7.4/alpine3.16/cli/docker-php-ext-enable b/8.2/alpine3.23/cli/docker-php-ext-enable similarity index 100% rename from 7.4/alpine3.16/cli/docker-php-ext-enable rename to 8.2/alpine3.23/cli/docker-php-ext-enable diff --git a/7.4/alpine3.15/fpm/docker-php-ext-install b/8.2/alpine3.23/cli/docker-php-ext-install similarity index 98% rename from 7.4/alpine3.15/fpm/docker-php-ext-install rename to 8.2/alpine3.23/cli/docker-php-ext-install index aa0b96c5a3..fbf44849c0 100755 --- a/7.4/alpine3.15/fpm/docker-php-ext-install +++ b/8.2/alpine3.23/cli/docker-php-ext-install @@ -126,7 +126,7 @@ for ext in $exts; do find modules \ -maxdepth 1 \ -name '*.so' \ - -exec basename '{}' ';' \ + -exec basename '{}' '.so' ';' \ | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} make -j"$j" clean diff --git a/7.4/alpine3.16/cli/docker-php-source b/8.2/alpine3.23/cli/docker-php-source similarity index 100% rename from 7.4/alpine3.16/cli/docker-php-source rename to 8.2/alpine3.23/cli/docker-php-source diff --git a/8.2-rc/alpine3.16/fpm/Dockerfile b/8.2/alpine3.23/fpm/Dockerfile similarity index 78% rename from 8.2-rc/alpine3.16/fpm/Dockerfile rename to 8.2/alpine3.23/fpm/Dockerfile index 9fd96c7d1a..875fc69043 100644 --- a/8.2-rc/alpine3.16/fpm/Dockerfile +++ b/8.2/alpine3.23/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -57,9 +56,9 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -156,9 +156,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -204,6 +205,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -211,27 +215,19 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -246,7 +242,12 @@ RUN set -eux; \ echo; \ echo '[www]'; \ echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/7.4/alpine3.16/fpm/docker-php-entrypoint b/8.2/alpine3.23/fpm/docker-php-entrypoint similarity index 100% rename from 7.4/alpine3.16/fpm/docker-php-entrypoint rename to 8.2/alpine3.23/fpm/docker-php-entrypoint diff --git a/7.4/alpine3.16/fpm/docker-php-ext-configure b/8.2/alpine3.23/fpm/docker-php-ext-configure similarity index 100% rename from 7.4/alpine3.16/fpm/docker-php-ext-configure rename to 8.2/alpine3.23/fpm/docker-php-ext-configure diff --git a/7.4/alpine3.16/fpm/docker-php-ext-enable b/8.2/alpine3.23/fpm/docker-php-ext-enable similarity index 100% rename from 7.4/alpine3.16/fpm/docker-php-ext-enable rename to 8.2/alpine3.23/fpm/docker-php-ext-enable diff --git a/8.2/alpine3.23/fpm/docker-php-ext-install b/8.2/alpine3.23/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/alpine3.23/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/alpine3.16/fpm/docker-php-source b/8.2/alpine3.23/fpm/docker-php-source similarity index 100% rename from 7.4/alpine3.16/fpm/docker-php-source rename to 8.2/alpine3.23/fpm/docker-php-source diff --git a/8.2-rc/alpine3.16/zts/Dockerfile b/8.2/alpine3.23/zts/Dockerfile similarity index 72% rename from 8.2-rc/alpine3.16/zts/Dockerfile rename to 8.2/alpine3.23/zts/Dockerfile index f35b94079c..1e87572b11 100644 --- a/8.2-rc/alpine3.16/zts/Dockerfile +++ b/8.2/alpine3.23/zts/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -57,9 +56,9 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -101,6 +98,8 @@ RUN set -eux; \ linux-headers \ oniguruma-dev \ openssl-dev \ + patch \ + patchutils \ readline-dev \ sqlite-dev \ ; \ @@ -112,12 +111,23 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ + # https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c" + # https://github.com/docker-library/php/pull/1580 + curl -fL 'https://github.com/php/php-src/commit/b3c8afe272a6919248986c703c2e1defc73ff707.patch?full_index=1' -o 18743.patch; \ + echo 'b334f73434c9732a4b27a42eb5d417e10df842e854c02a3e753b2479f8978bf5 *18743.patch' | sha256sum -c -; \ + filterdiff -x '*/NEWS' 18743.patch | patch -p1; \ + rm 18743.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +140,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -150,19 +158,25 @@ RUN set -eux; \ --with-readline \ --with-zlib \ \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-musl' && echo '--without-pcre-jit') \ \ - --disable-cgi \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ \ --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + --enable-zend-max-execution-timers \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -202,6 +216,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/alpine3.16/zts/docker-php-entrypoint b/8.2/alpine3.23/zts/docker-php-entrypoint similarity index 100% rename from 7.4/alpine3.16/zts/docker-php-entrypoint rename to 8.2/alpine3.23/zts/docker-php-entrypoint diff --git a/7.4/alpine3.16/zts/docker-php-ext-configure b/8.2/alpine3.23/zts/docker-php-ext-configure similarity index 100% rename from 7.4/alpine3.16/zts/docker-php-ext-configure rename to 8.2/alpine3.23/zts/docker-php-ext-configure diff --git a/7.4/alpine3.16/zts/docker-php-ext-enable b/8.2/alpine3.23/zts/docker-php-ext-enable similarity index 100% rename from 7.4/alpine3.16/zts/docker-php-ext-enable rename to 8.2/alpine3.23/zts/docker-php-ext-enable diff --git a/8.2/alpine3.23/zts/docker-php-ext-install b/8.2/alpine3.23/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/alpine3.23/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/alpine3.16/zts/docker-php-source b/8.2/alpine3.23/zts/docker-php-source similarity index 100% rename from 7.4/alpine3.16/zts/docker-php-source rename to 8.2/alpine3.23/zts/docker-php-source diff --git a/8.2-rc/bullseye/apache/Dockerfile b/8.2/bookworm/apache/Dockerfile similarity index 81% rename from 8.2-rc/bullseye/apache/Dockerfile rename to 8.2/bookworm/apache/Dockerfile index 680aa1bc63..d75f740ada 100644 --- a/8.2-rc/bullseye/apache/Dockerfile +++ b/8.2/bookworm/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -118,15 +120,15 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,10 +261,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -276,6 +281,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/bullseye/apache/apache2-foreground b/8.2/bookworm/apache/apache2-foreground similarity index 100% rename from 7.4/bullseye/apache/apache2-foreground rename to 8.2/bookworm/apache/apache2-foreground diff --git a/7.4/bullseye/apache/docker-php-entrypoint b/8.2/bookworm/apache/docker-php-entrypoint similarity index 100% rename from 7.4/bullseye/apache/docker-php-entrypoint rename to 8.2/bookworm/apache/docker-php-entrypoint diff --git a/7.4/bullseye/apache/docker-php-ext-configure b/8.2/bookworm/apache/docker-php-ext-configure similarity index 100% rename from 7.4/bullseye/apache/docker-php-ext-configure rename to 8.2/bookworm/apache/docker-php-ext-configure diff --git a/7.4/bullseye/apache/docker-php-ext-enable b/8.2/bookworm/apache/docker-php-ext-enable similarity index 100% rename from 7.4/bullseye/apache/docker-php-ext-enable rename to 8.2/bookworm/apache/docker-php-ext-enable diff --git a/8.2/bookworm/apache/docker-php-ext-install b/8.2/bookworm/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/bookworm/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/bullseye/apache/docker-php-source b/8.2/bookworm/apache/docker-php-source similarity index 100% rename from 7.4/bullseye/apache/docker-php-source rename to 8.2/bookworm/apache/docker-php-source diff --git a/8.2-rc/bullseye/cli/Dockerfile b/8.2/bookworm/cli/Dockerfile similarity index 77% rename from 8.2-rc/bullseye/cli/Dockerfile rename to 8.2/bookworm/cli/Dockerfile index fc7b938aa4..9d2c922e42 100644 --- a/8.2-rc/bullseye/cli/Dockerfile +++ b/8.2/bookworm/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -60,15 +60,15 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,9 +168,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 @@ -198,10 +200,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -217,6 +220,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/bullseye/cli/docker-php-entrypoint b/8.2/bookworm/cli/docker-php-entrypoint similarity index 100% rename from 7.4/bullseye/cli/docker-php-entrypoint rename to 8.2/bookworm/cli/docker-php-entrypoint diff --git a/7.4/bullseye/cli/docker-php-ext-configure b/8.2/bookworm/cli/docker-php-ext-configure similarity index 100% rename from 7.4/bullseye/cli/docker-php-ext-configure rename to 8.2/bookworm/cli/docker-php-ext-configure diff --git a/7.4/bullseye/cli/docker-php-ext-enable b/8.2/bookworm/cli/docker-php-ext-enable similarity index 100% rename from 7.4/bullseye/cli/docker-php-ext-enable rename to 8.2/bookworm/cli/docker-php-ext-enable diff --git a/8.2/bookworm/cli/docker-php-ext-install b/8.2/bookworm/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/bookworm/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/bullseye/cli/docker-php-source b/8.2/bookworm/cli/docker-php-source similarity index 100% rename from 7.4/bullseye/cli/docker-php-source rename to 8.2/bookworm/cli/docker-php-source diff --git a/8.2-rc/bullseye/fpm/Dockerfile b/8.2/bookworm/fpm/Dockerfile similarity index 75% rename from 8.2-rc/bullseye/fpm/Dockerfile rename to 8.2/bookworm/fpm/Dockerfile index 89caeb464c..4eb1c4e269 100644 --- a/8.2-rc/bullseye/fpm/Dockerfile +++ b/8.2/bookworm/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -60,15 +60,15 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,10 +202,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -219,6 +222,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -226,27 +232,19 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -261,7 +259,12 @@ RUN set -eux; \ echo; \ echo '[www]'; \ echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/7.4/bullseye/fpm/docker-php-entrypoint b/8.2/bookworm/fpm/docker-php-entrypoint similarity index 100% rename from 7.4/bullseye/fpm/docker-php-entrypoint rename to 8.2/bookworm/fpm/docker-php-entrypoint diff --git a/7.4/bullseye/fpm/docker-php-ext-configure b/8.2/bookworm/fpm/docker-php-ext-configure similarity index 100% rename from 7.4/bullseye/fpm/docker-php-ext-configure rename to 8.2/bookworm/fpm/docker-php-ext-configure diff --git a/7.4/bullseye/fpm/docker-php-ext-enable b/8.2/bookworm/fpm/docker-php-ext-enable similarity index 100% rename from 7.4/bullseye/fpm/docker-php-ext-enable rename to 8.2/bookworm/fpm/docker-php-ext-enable diff --git a/8.2/bookworm/fpm/docker-php-ext-install b/8.2/bookworm/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/bookworm/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/bullseye/fpm/docker-php-source b/8.2/bookworm/fpm/docker-php-source similarity index 100% rename from 7.4/bullseye/fpm/docker-php-source rename to 8.2/bookworm/fpm/docker-php-source diff --git a/8.2-rc/bullseye/zts/Dockerfile b/8.2/bookworm/zts/Dockerfile similarity index 75% rename from 8.2-rc/bullseye/zts/Dockerfile rename to 8.2/bookworm/zts/Dockerfile index e51dc7d634..9edffa87ef 100644 --- a/8.2-rc/bullseye/zts/Dockerfile +++ b/8.2/bookworm/zts/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -60,15 +60,15 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -160,23 +161,26 @@ RUN set -eux; \ --with-readline \ --with-zlib \ \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - --disable-cgi \ - \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 --enable-embed \ \ --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + --enable-zend-max-execution-timers \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -201,10 +205,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -220,6 +225,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/bullseye/zts/docker-php-entrypoint b/8.2/bookworm/zts/docker-php-entrypoint similarity index 100% rename from 7.4/bullseye/zts/docker-php-entrypoint rename to 8.2/bookworm/zts/docker-php-entrypoint diff --git a/7.4/bullseye/zts/docker-php-ext-configure b/8.2/bookworm/zts/docker-php-ext-configure similarity index 100% rename from 7.4/bullseye/zts/docker-php-ext-configure rename to 8.2/bookworm/zts/docker-php-ext-configure diff --git a/7.4/bullseye/zts/docker-php-ext-enable b/8.2/bookworm/zts/docker-php-ext-enable similarity index 100% rename from 7.4/bullseye/zts/docker-php-ext-enable rename to 8.2/bookworm/zts/docker-php-ext-enable diff --git a/8.2/bookworm/zts/docker-php-ext-install b/8.2/bookworm/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/bookworm/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/bullseye/zts/docker-php-source b/8.2/bookworm/zts/docker-php-source similarity index 100% rename from 7.4/bullseye/zts/docker-php-source rename to 8.2/bookworm/zts/docker-php-source diff --git a/8.2-rc/buster/apache/Dockerfile b/8.2/trixie/apache/Dockerfile similarity index 80% rename from 8.2-rc/buster/apache/Dockerfile rename to 8.2/trixie/apache/Dockerfile index 4812323315..3ef955c2f1 100644 --- a/8.2-rc/buster/apache/Dockerfile +++ b/8.2/trixie/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -54,7 +54,7 @@ ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends apache2; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # generically convert lines like # export APACHE_RUN_USER=www-data @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -118,16 +120,16 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,15 +261,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -276,6 +281,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/buster/apache/apache2-foreground b/8.2/trixie/apache/apache2-foreground similarity index 100% rename from 7.4/buster/apache/apache2-foreground rename to 8.2/trixie/apache/apache2-foreground diff --git a/7.4/buster/apache/docker-php-entrypoint b/8.2/trixie/apache/docker-php-entrypoint similarity index 100% rename from 7.4/buster/apache/docker-php-entrypoint rename to 8.2/trixie/apache/docker-php-entrypoint diff --git a/7.4/buster/apache/docker-php-ext-configure b/8.2/trixie/apache/docker-php-ext-configure similarity index 100% rename from 7.4/buster/apache/docker-php-ext-configure rename to 8.2/trixie/apache/docker-php-ext-configure diff --git a/7.4/buster/apache/docker-php-ext-enable b/8.2/trixie/apache/docker-php-ext-enable similarity index 100% rename from 7.4/buster/apache/docker-php-ext-enable rename to 8.2/trixie/apache/docker-php-ext-enable diff --git a/8.2/trixie/apache/docker-php-ext-install b/8.2/trixie/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/trixie/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/buster/apache/docker-php-source b/8.2/trixie/apache/docker-php-source similarity index 100% rename from 7.4/buster/apache/docker-php-source rename to 8.2/trixie/apache/docker-php-source diff --git a/8.2-rc/buster/cli/Dockerfile b/8.2/trixie/cli/Dockerfile similarity index 76% rename from 8.2-rc/buster/cli/Dockerfile rename to 8.2/trixie/cli/Dockerfile index 9cde05d7c9..be20bb2e3d 100644 --- a/8.2-rc/buster/cli/Dockerfile +++ b/8.2/trixie/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -60,16 +60,16 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,9 +168,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 @@ -198,15 +200,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -217,6 +220,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/buster/cli/docker-php-entrypoint b/8.2/trixie/cli/docker-php-entrypoint similarity index 100% rename from 7.4/buster/cli/docker-php-entrypoint rename to 8.2/trixie/cli/docker-php-entrypoint diff --git a/7.4/buster/cli/docker-php-ext-configure b/8.2/trixie/cli/docker-php-ext-configure similarity index 100% rename from 7.4/buster/cli/docker-php-ext-configure rename to 8.2/trixie/cli/docker-php-ext-configure diff --git a/7.4/buster/cli/docker-php-ext-enable b/8.2/trixie/cli/docker-php-ext-enable similarity index 100% rename from 7.4/buster/cli/docker-php-ext-enable rename to 8.2/trixie/cli/docker-php-ext-enable diff --git a/8.2/trixie/cli/docker-php-ext-install b/8.2/trixie/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/trixie/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/buster/cli/docker-php-source b/8.2/trixie/cli/docker-php-source similarity index 100% rename from 7.4/buster/cli/docker-php-source rename to 8.2/trixie/cli/docker-php-source diff --git a/8.2-rc/buster/fpm/Dockerfile b/8.2/trixie/fpm/Dockerfile similarity index 74% rename from 8.2-rc/buster/fpm/Dockerfile rename to 8.2/trixie/fpm/Dockerfile index 77b0b83c53..e3d8bc18ff 100644 --- a/8.2-rc/buster/fpm/Dockerfile +++ b/8.2/trixie/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -60,16 +60,16 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,10 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,15 +202,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -219,6 +222,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -226,27 +232,19 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -261,7 +259,12 @@ RUN set -eux; \ echo; \ echo '[www]'; \ echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/7.4/buster/fpm/docker-php-entrypoint b/8.2/trixie/fpm/docker-php-entrypoint similarity index 100% rename from 7.4/buster/fpm/docker-php-entrypoint rename to 8.2/trixie/fpm/docker-php-entrypoint diff --git a/7.4/buster/fpm/docker-php-ext-configure b/8.2/trixie/fpm/docker-php-ext-configure similarity index 100% rename from 7.4/buster/fpm/docker-php-ext-configure rename to 8.2/trixie/fpm/docker-php-ext-configure diff --git a/7.4/buster/fpm/docker-php-ext-enable b/8.2/trixie/fpm/docker-php-ext-enable similarity index 100% rename from 7.4/buster/fpm/docker-php-ext-enable rename to 8.2/trixie/fpm/docker-php-ext-enable diff --git a/8.2/trixie/fpm/docker-php-ext-install b/8.2/trixie/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/trixie/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/buster/fpm/docker-php-source b/8.2/trixie/fpm/docker-php-source similarity index 100% rename from 7.4/buster/fpm/docker-php-source rename to 8.2/trixie/fpm/docker-php-source diff --git a/8.2-rc/buster/zts/Dockerfile b/8.2/trixie/zts/Dockerfile similarity index 74% rename from 8.2-rc/buster/zts/Dockerfile rename to 8.2/trixie/zts/Dockerfile index a3ab484044..0650f31659 100644 --- a/8.2-rc/buster/zts/Dockerfile +++ b/8.2/trixie/zts/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -60,16 +60,16 @@ ENV PHP_LDFLAGS="-Wl,-O1 -pie" ENV GPG_KEYS 39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC -ENV PHP_VERSION 8.2.0alpha1 -ENV PHP_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc" -ENV PHP_SHA256="08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a" +ENV PHP_VERSION 8.2.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.2.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.2.30.tar.xz.asc" +ENV PHP_SHA256="bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -160,23 +161,26 @@ RUN set -eux; \ --with-readline \ --with-zlib \ \ -# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.") - --disable-phpdbg \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ - --disable-cgi \ - \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 --enable-embed \ \ --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + --enable-zend-max-execution-timers \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -201,15 +205,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -220,6 +225,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/7.4/buster/zts/docker-php-entrypoint b/8.2/trixie/zts/docker-php-entrypoint similarity index 100% rename from 7.4/buster/zts/docker-php-entrypoint rename to 8.2/trixie/zts/docker-php-entrypoint diff --git a/7.4/buster/zts/docker-php-ext-configure b/8.2/trixie/zts/docker-php-ext-configure similarity index 100% rename from 7.4/buster/zts/docker-php-ext-configure rename to 8.2/trixie/zts/docker-php-ext-configure diff --git a/7.4/buster/zts/docker-php-ext-enable b/8.2/trixie/zts/docker-php-ext-enable similarity index 100% rename from 7.4/buster/zts/docker-php-ext-enable rename to 8.2/trixie/zts/docker-php-ext-enable diff --git a/8.2/trixie/zts/docker-php-ext-install b/8.2/trixie/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.2/trixie/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.4/buster/zts/docker-php-source b/8.2/trixie/zts/docker-php-source similarity index 100% rename from 7.4/buster/zts/docker-php-source rename to 8.2/trixie/zts/docker-php-source diff --git a/8.0/alpine3.15/cli/Dockerfile b/8.3/alpine3.22/cli/Dockerfile similarity index 82% rename from 8.0/alpine3.15/cli/Dockerfile rename to 8.3/alpine3.22/cli/Dockerfile index 10b7ca7bda..22b241fc21 100644 --- a/8.0/alpine3.15/cli/Dockerfile +++ b/8.3/alpine3.22/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -157,9 +157,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -199,6 +196,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0-rc/alpine3.15/cli/docker-php-entrypoint b/8.3/alpine3.22/cli/docker-php-entrypoint similarity index 100% rename from 8.0-rc/alpine3.15/cli/docker-php-entrypoint rename to 8.3/alpine3.22/cli/docker-php-entrypoint diff --git a/8.0-rc/alpine3.15/cli/docker-php-ext-configure b/8.3/alpine3.22/cli/docker-php-ext-configure similarity index 100% rename from 8.0-rc/alpine3.15/cli/docker-php-ext-configure rename to 8.3/alpine3.22/cli/docker-php-ext-configure diff --git a/8.0-rc/alpine3.15/cli/docker-php-ext-enable b/8.3/alpine3.22/cli/docker-php-ext-enable similarity index 100% rename from 8.0-rc/alpine3.15/cli/docker-php-ext-enable rename to 8.3/alpine3.22/cli/docker-php-ext-enable diff --git a/8.3/alpine3.22/cli/docker-php-ext-install b/8.3/alpine3.22/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/alpine3.22/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/alpine3.15/cli/docker-php-source b/8.3/alpine3.22/cli/docker-php-source similarity index 100% rename from 8.0-rc/alpine3.15/cli/docker-php-source rename to 8.3/alpine3.22/cli/docker-php-source diff --git a/7.4/alpine3.16/fpm/Dockerfile b/8.3/alpine3.22/fpm/Dockerfile similarity index 75% rename from 7.4/alpine3.16/fpm/Dockerfile rename to 8.3/alpine3.22/fpm/Dockerfile index b2d69b095e..09c1cb8bc6 100644 --- a/7.4/alpine3.16/fpm/Dockerfile +++ b/8.3/alpine3.22/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -107,19 +104,22 @@ RUN set -eux; \ \ # make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) rm -vf /usr/include/iconv.h; \ -# PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df - ln -sv /usr/include/gnu-libiconv/*.h /usr/include/; \ \ export \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -132,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -158,9 +156,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -206,6 +201,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -213,27 +211,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -241,14 +236,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0-rc/alpine3.15/fpm/docker-php-entrypoint b/8.3/alpine3.22/fpm/docker-php-entrypoint similarity index 100% rename from 8.0-rc/alpine3.15/fpm/docker-php-entrypoint rename to 8.3/alpine3.22/fpm/docker-php-entrypoint diff --git a/8.0-rc/alpine3.15/fpm/docker-php-ext-configure b/8.3/alpine3.22/fpm/docker-php-ext-configure similarity index 100% rename from 8.0-rc/alpine3.15/fpm/docker-php-ext-configure rename to 8.3/alpine3.22/fpm/docker-php-ext-configure diff --git a/8.0-rc/alpine3.15/fpm/docker-php-ext-enable b/8.3/alpine3.22/fpm/docker-php-ext-enable similarity index 100% rename from 8.0-rc/alpine3.15/fpm/docker-php-ext-enable rename to 8.3/alpine3.22/fpm/docker-php-ext-enable diff --git a/8.3/alpine3.22/fpm/docker-php-ext-install b/8.3/alpine3.22/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/alpine3.22/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/alpine3.15/fpm/docker-php-source b/8.3/alpine3.22/fpm/docker-php-source similarity index 100% rename from 8.0-rc/alpine3.15/fpm/docker-php-source rename to 8.3/alpine3.22/fpm/docker-php-source diff --git a/8.3/alpine3.22/zts/Dockerfile b/8.3/alpine3.22/zts/Dockerfile new file mode 100644 index 0000000000..59a31fccfe --- /dev/null +++ b/8.3/alpine3.22/zts/Dockerfile @@ -0,0 +1,213 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.22 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA + +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0-rc/alpine3.15/zts/docker-php-entrypoint b/8.3/alpine3.22/zts/docker-php-entrypoint similarity index 100% rename from 8.0-rc/alpine3.15/zts/docker-php-entrypoint rename to 8.3/alpine3.22/zts/docker-php-entrypoint diff --git a/8.0-rc/alpine3.15/zts/docker-php-ext-configure b/8.3/alpine3.22/zts/docker-php-ext-configure similarity index 100% rename from 8.0-rc/alpine3.15/zts/docker-php-ext-configure rename to 8.3/alpine3.22/zts/docker-php-ext-configure diff --git a/8.0-rc/alpine3.15/zts/docker-php-ext-enable b/8.3/alpine3.22/zts/docker-php-ext-enable similarity index 100% rename from 8.0-rc/alpine3.15/zts/docker-php-ext-enable rename to 8.3/alpine3.22/zts/docker-php-ext-enable diff --git a/8.3/alpine3.22/zts/docker-php-ext-install b/8.3/alpine3.22/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/alpine3.22/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/alpine3.15/zts/docker-php-source b/8.3/alpine3.22/zts/docker-php-source similarity index 100% rename from 8.0-rc/alpine3.15/zts/docker-php-source rename to 8.3/alpine3.22/zts/docker-php-source diff --git a/8.0/alpine3.16/cli/Dockerfile b/8.3/alpine3.23/cli/Dockerfile similarity index 82% rename from 8.0/alpine3.16/cli/Dockerfile rename to 8.3/alpine3.23/cli/Dockerfile index 200b5feae0..206b819baf 100644 --- a/8.0/alpine3.16/cli/Dockerfile +++ b/8.3/alpine3.23/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -157,9 +157,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -199,6 +196,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0-rc/alpine3.16/cli/docker-php-entrypoint b/8.3/alpine3.23/cli/docker-php-entrypoint similarity index 100% rename from 8.0-rc/alpine3.16/cli/docker-php-entrypoint rename to 8.3/alpine3.23/cli/docker-php-entrypoint diff --git a/8.0-rc/alpine3.16/cli/docker-php-ext-configure b/8.3/alpine3.23/cli/docker-php-ext-configure similarity index 100% rename from 8.0-rc/alpine3.16/cli/docker-php-ext-configure rename to 8.3/alpine3.23/cli/docker-php-ext-configure diff --git a/8.0-rc/alpine3.16/cli/docker-php-ext-enable b/8.3/alpine3.23/cli/docker-php-ext-enable similarity index 100% rename from 8.0-rc/alpine3.16/cli/docker-php-ext-enable rename to 8.3/alpine3.23/cli/docker-php-ext-enable diff --git a/8.3/alpine3.23/cli/docker-php-ext-install b/8.3/alpine3.23/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/alpine3.23/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/alpine3.16/cli/docker-php-source b/8.3/alpine3.23/cli/docker-php-source similarity index 100% rename from 8.0-rc/alpine3.16/cli/docker-php-source rename to 8.3/alpine3.23/cli/docker-php-source diff --git a/8.0/alpine3.15/fpm/Dockerfile b/8.3/alpine3.23/fpm/Dockerfile similarity index 75% rename from 8.0/alpine3.15/fpm/Dockerfile rename to 8.3/alpine3.23/fpm/Dockerfile index 2e0fa31034..96c5ff0b60 100644 --- a/8.0/alpine3.15/fpm/Dockerfile +++ b/8.3/alpine3.23/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -156,9 +156,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -204,6 +201,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -211,27 +211,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -239,14 +236,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0-rc/alpine3.16/fpm/docker-php-entrypoint b/8.3/alpine3.23/fpm/docker-php-entrypoint similarity index 100% rename from 8.0-rc/alpine3.16/fpm/docker-php-entrypoint rename to 8.3/alpine3.23/fpm/docker-php-entrypoint diff --git a/8.0-rc/alpine3.16/fpm/docker-php-ext-configure b/8.3/alpine3.23/fpm/docker-php-ext-configure similarity index 100% rename from 8.0-rc/alpine3.16/fpm/docker-php-ext-configure rename to 8.3/alpine3.23/fpm/docker-php-ext-configure diff --git a/8.0-rc/alpine3.16/fpm/docker-php-ext-enable b/8.3/alpine3.23/fpm/docker-php-ext-enable similarity index 100% rename from 8.0-rc/alpine3.16/fpm/docker-php-ext-enable rename to 8.3/alpine3.23/fpm/docker-php-ext-enable diff --git a/8.3/alpine3.23/fpm/docker-php-ext-install b/8.3/alpine3.23/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/alpine3.23/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/alpine3.16/fpm/docker-php-source b/8.3/alpine3.23/fpm/docker-php-source similarity index 100% rename from 8.0-rc/alpine3.16/fpm/docker-php-source rename to 8.3/alpine3.23/fpm/docker-php-source diff --git a/8.3/alpine3.23/zts/Dockerfile b/8.3/alpine3.23/zts/Dockerfile new file mode 100644 index 0000000000..4cb74d8d05 --- /dev/null +++ b/8.3/alpine3.23/zts/Dockerfile @@ -0,0 +1,213 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.23 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA + +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0-rc/alpine3.16/zts/docker-php-entrypoint b/8.3/alpine3.23/zts/docker-php-entrypoint similarity index 100% rename from 8.0-rc/alpine3.16/zts/docker-php-entrypoint rename to 8.3/alpine3.23/zts/docker-php-entrypoint diff --git a/8.0-rc/alpine3.16/zts/docker-php-ext-configure b/8.3/alpine3.23/zts/docker-php-ext-configure similarity index 100% rename from 8.0-rc/alpine3.16/zts/docker-php-ext-configure rename to 8.3/alpine3.23/zts/docker-php-ext-configure diff --git a/8.0-rc/alpine3.16/zts/docker-php-ext-enable b/8.3/alpine3.23/zts/docker-php-ext-enable similarity index 100% rename from 8.0-rc/alpine3.16/zts/docker-php-ext-enable rename to 8.3/alpine3.23/zts/docker-php-ext-enable diff --git a/8.3/alpine3.23/zts/docker-php-ext-install b/8.3/alpine3.23/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/alpine3.23/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/alpine3.16/zts/docker-php-source b/8.3/alpine3.23/zts/docker-php-source similarity index 100% rename from 8.0-rc/alpine3.16/zts/docker-php-source rename to 8.3/alpine3.23/zts/docker-php-source diff --git a/8.0/bullseye/apache/Dockerfile b/8.3/bookworm/apache/Dockerfile similarity index 82% rename from 8.0/bullseye/apache/Dockerfile rename to 8.3/bookworm/apache/Dockerfile index bdff703e1b..f95e2f08fc 100644 --- a/8.0/bullseye/apache/Dockerfile +++ b/8.3/bookworm/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -116,17 +118,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,10 +257,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -276,6 +277,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0-rc/bullseye/apache/apache2-foreground b/8.3/bookworm/apache/apache2-foreground similarity index 100% rename from 8.0-rc/bullseye/apache/apache2-foreground rename to 8.3/bookworm/apache/apache2-foreground diff --git a/8.0-rc/bullseye/apache/docker-php-entrypoint b/8.3/bookworm/apache/docker-php-entrypoint similarity index 100% rename from 8.0-rc/bullseye/apache/docker-php-entrypoint rename to 8.3/bookworm/apache/docker-php-entrypoint diff --git a/8.0-rc/bullseye/apache/docker-php-ext-configure b/8.3/bookworm/apache/docker-php-ext-configure similarity index 100% rename from 8.0-rc/bullseye/apache/docker-php-ext-configure rename to 8.3/bookworm/apache/docker-php-ext-configure diff --git a/8.0-rc/bullseye/apache/docker-php-ext-enable b/8.3/bookworm/apache/docker-php-ext-enable similarity index 100% rename from 8.0-rc/bullseye/apache/docker-php-ext-enable rename to 8.3/bookworm/apache/docker-php-ext-enable diff --git a/8.3/bookworm/apache/docker-php-ext-install b/8.3/bookworm/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/bookworm/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/bullseye/apache/docker-php-source b/8.3/bookworm/apache/docker-php-source similarity index 100% rename from 8.0-rc/bullseye/apache/docker-php-source rename to 8.3/bookworm/apache/docker-php-source diff --git a/8.0/bullseye/cli/Dockerfile b/8.3/bookworm/cli/Dockerfile similarity index 79% rename from 8.0/bullseye/cli/Dockerfile rename to 8.3/bookworm/cli/Dockerfile index 700575e7d2..4da57fbe71 100644 --- a/8.0/bullseye/cli/Dockerfile +++ b/8.3/bookworm/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,9 +168,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 @@ -198,10 +196,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -217,6 +216,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0-rc/bullseye/cli/docker-php-entrypoint b/8.3/bookworm/cli/docker-php-entrypoint similarity index 100% rename from 8.0-rc/bullseye/cli/docker-php-entrypoint rename to 8.3/bookworm/cli/docker-php-entrypoint diff --git a/8.0-rc/bullseye/cli/docker-php-ext-configure b/8.3/bookworm/cli/docker-php-ext-configure similarity index 100% rename from 8.0-rc/bullseye/cli/docker-php-ext-configure rename to 8.3/bookworm/cli/docker-php-ext-configure diff --git a/8.0-rc/bullseye/cli/docker-php-ext-enable b/8.3/bookworm/cli/docker-php-ext-enable similarity index 100% rename from 8.0-rc/bullseye/cli/docker-php-ext-enable rename to 8.3/bookworm/cli/docker-php-ext-enable diff --git a/8.3/bookworm/cli/docker-php-ext-install b/8.3/bookworm/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/bookworm/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/bullseye/cli/docker-php-source b/8.3/bookworm/cli/docker-php-source similarity index 100% rename from 8.0-rc/bullseye/cli/docker-php-source rename to 8.3/bookworm/cli/docker-php-source diff --git a/7.4/bullseye/fpm/Dockerfile b/8.3/bookworm/fpm/Dockerfile similarity index 72% rename from 7.4/bullseye/fpm/Dockerfile rename to 8.3/bookworm/fpm/Dockerfile index 00b9547e92..f1564b1d59 100644 --- a/7.4/bullseye/fpm/Dockerfile +++ b/8.3/bookworm/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,10 +198,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -219,6 +218,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -226,27 +228,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -254,14 +253,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0-rc/bullseye/fpm/docker-php-entrypoint b/8.3/bookworm/fpm/docker-php-entrypoint similarity index 100% rename from 8.0-rc/bullseye/fpm/docker-php-entrypoint rename to 8.3/bookworm/fpm/docker-php-entrypoint diff --git a/8.0-rc/bullseye/fpm/docker-php-ext-configure b/8.3/bookworm/fpm/docker-php-ext-configure similarity index 100% rename from 8.0-rc/bullseye/fpm/docker-php-ext-configure rename to 8.3/bookworm/fpm/docker-php-ext-configure diff --git a/8.0-rc/bullseye/fpm/docker-php-ext-enable b/8.3/bookworm/fpm/docker-php-ext-enable similarity index 100% rename from 8.0-rc/bullseye/fpm/docker-php-ext-enable rename to 8.3/bookworm/fpm/docker-php-ext-enable diff --git a/8.3/bookworm/fpm/docker-php-ext-install b/8.3/bookworm/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/bookworm/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/bullseye/fpm/docker-php-source b/8.3/bookworm/fpm/docker-php-source similarity index 100% rename from 8.0-rc/bullseye/fpm/docker-php-source rename to 8.3/bookworm/fpm/docker-php-source diff --git a/8.0/buster/cli/Dockerfile b/8.3/bookworm/zts/Dockerfile similarity index 78% rename from 8.0/buster/cli/Dockerfile rename to 8.3/bookworm/zts/Dockerfile index 55c811ecef..216ad65871 100644 --- a/8.0/buster/cli/Dockerfile +++ b/8.3/bookworm/zts/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,13 +168,14 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -198,10 +200,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -217,6 +220,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0-rc/bullseye/zts/docker-php-entrypoint b/8.3/bookworm/zts/docker-php-entrypoint similarity index 100% rename from 8.0-rc/bullseye/zts/docker-php-entrypoint rename to 8.3/bookworm/zts/docker-php-entrypoint diff --git a/8.0-rc/bullseye/zts/docker-php-ext-configure b/8.3/bookworm/zts/docker-php-ext-configure similarity index 100% rename from 8.0-rc/bullseye/zts/docker-php-ext-configure rename to 8.3/bookworm/zts/docker-php-ext-configure diff --git a/8.0-rc/bullseye/zts/docker-php-ext-enable b/8.3/bookworm/zts/docker-php-ext-enable similarity index 100% rename from 8.0-rc/bullseye/zts/docker-php-ext-enable rename to 8.3/bookworm/zts/docker-php-ext-enable diff --git a/8.3/bookworm/zts/docker-php-ext-install b/8.3/bookworm/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/bookworm/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/bullseye/zts/docker-php-source b/8.3/bookworm/zts/docker-php-source similarity index 100% rename from 8.0-rc/bullseye/zts/docker-php-source rename to 8.3/bookworm/zts/docker-php-source diff --git a/8.0/buster/apache/Dockerfile b/8.3/trixie/apache/Dockerfile similarity index 81% rename from 8.0/buster/apache/Dockerfile rename to 8.3/trixie/apache/Dockerfile index b39097547f..70872eece3 100644 --- a/8.0/buster/apache/Dockerfile +++ b/8.3/trixie/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -54,7 +54,7 @@ ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends apache2; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # generically convert lines like # export APACHE_RUN_USER=www-data @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -116,18 +118,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,15 +257,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -276,6 +277,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0-rc/buster/apache/apache2-foreground b/8.3/trixie/apache/apache2-foreground similarity index 100% rename from 8.0-rc/buster/apache/apache2-foreground rename to 8.3/trixie/apache/apache2-foreground diff --git a/8.0-rc/buster/apache/docker-php-entrypoint b/8.3/trixie/apache/docker-php-entrypoint similarity index 100% rename from 8.0-rc/buster/apache/docker-php-entrypoint rename to 8.3/trixie/apache/docker-php-entrypoint diff --git a/8.0-rc/buster/apache/docker-php-ext-configure b/8.3/trixie/apache/docker-php-ext-configure similarity index 100% rename from 8.0-rc/buster/apache/docker-php-ext-configure rename to 8.3/trixie/apache/docker-php-ext-configure diff --git a/8.0-rc/buster/apache/docker-php-ext-enable b/8.3/trixie/apache/docker-php-ext-enable similarity index 100% rename from 8.0-rc/buster/apache/docker-php-ext-enable rename to 8.3/trixie/apache/docker-php-ext-enable diff --git a/8.3/trixie/apache/docker-php-ext-install b/8.3/trixie/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/trixie/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/buster/apache/docker-php-source b/8.3/trixie/apache/docker-php-source similarity index 100% rename from 8.0-rc/buster/apache/docker-php-source rename to 8.3/trixie/apache/docker-php-source diff --git a/8.3/trixie/cli/Dockerfile b/8.3/trixie/cli/Dockerfile new file mode 100644 index 0000000000..6856b15ae5 --- /dev/null +++ b/8.3/trixie/cli/Dockerfile @@ -0,0 +1,226 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:trixie-slim + +# prevent Debian's PHP packages from being installed +# https://github.com/docker-library/php/pull/542 +RUN set -eux; \ + { \ + echo 'Package: php*'; \ + echo 'Pin: release *'; \ + echo 'Pin-Priority: -1'; \ + } > /etc/apt/preferences.d/no-debian-php + +# dependencies required for running "phpize" +# (see persistent deps below) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config \ + re2c + +# persistent / runtime deps +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + xz-utils \ + ; \ + apt-get dist-clean + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA + +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libonig-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + --with-libdir="lib/$debMultiarch" \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ + | sort -u \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + apt-get dist-clean; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0-rc/buster/cli/docker-php-entrypoint b/8.3/trixie/cli/docker-php-entrypoint similarity index 100% rename from 8.0-rc/buster/cli/docker-php-entrypoint rename to 8.3/trixie/cli/docker-php-entrypoint diff --git a/8.0-rc/buster/cli/docker-php-ext-configure b/8.3/trixie/cli/docker-php-ext-configure similarity index 100% rename from 8.0-rc/buster/cli/docker-php-ext-configure rename to 8.3/trixie/cli/docker-php-ext-configure diff --git a/8.0-rc/buster/cli/docker-php-ext-enable b/8.3/trixie/cli/docker-php-ext-enable similarity index 100% rename from 8.0-rc/buster/cli/docker-php-ext-enable rename to 8.3/trixie/cli/docker-php-ext-enable diff --git a/8.3/trixie/cli/docker-php-ext-install b/8.3/trixie/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/trixie/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/buster/cli/docker-php-source b/8.3/trixie/cli/docker-php-source similarity index 100% rename from 8.0-rc/buster/cli/docker-php-source rename to 8.3/trixie/cli/docker-php-source diff --git a/7.4/buster/fpm/Dockerfile b/8.3/trixie/fpm/Dockerfile similarity index 72% rename from 7.4/buster/fpm/Dockerfile rename to 8.3/trixie/fpm/Dockerfile index 6ca99c2e3d..b196cacb29 100644 --- a/7.4/buster/fpm/Dockerfile +++ b/8.3/trixie/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,18 +58,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,15 +198,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -219,6 +218,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -226,27 +228,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -254,14 +253,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0-rc/buster/fpm/docker-php-entrypoint b/8.3/trixie/fpm/docker-php-entrypoint similarity index 100% rename from 8.0-rc/buster/fpm/docker-php-entrypoint rename to 8.3/trixie/fpm/docker-php-entrypoint diff --git a/8.0-rc/buster/fpm/docker-php-ext-configure b/8.3/trixie/fpm/docker-php-ext-configure similarity index 100% rename from 8.0-rc/buster/fpm/docker-php-ext-configure rename to 8.3/trixie/fpm/docker-php-ext-configure diff --git a/8.0-rc/buster/fpm/docker-php-ext-enable b/8.3/trixie/fpm/docker-php-ext-enable similarity index 100% rename from 8.0-rc/buster/fpm/docker-php-ext-enable rename to 8.3/trixie/fpm/docker-php-ext-enable diff --git a/8.3/trixie/fpm/docker-php-ext-install b/8.3/trixie/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/trixie/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/buster/fpm/docker-php-source b/8.3/trixie/fpm/docker-php-source similarity index 100% rename from 8.0-rc/buster/fpm/docker-php-source rename to 8.3/trixie/fpm/docker-php-source diff --git a/8.3/trixie/zts/Dockerfile b/8.3/trixie/zts/Dockerfile new file mode 100644 index 0000000000..4210a6b349 --- /dev/null +++ b/8.3/trixie/zts/Dockerfile @@ -0,0 +1,230 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:trixie-slim + +# prevent Debian's PHP packages from being installed +# https://github.com/docker-library/php/pull/542 +RUN set -eux; \ + { \ + echo 'Package: php*'; \ + echo 'Pin: release *'; \ + echo 'Pin-Priority: -1'; \ + } > /etc/apt/preferences.d/no-debian-php + +# dependencies required for running "phpize" +# (see persistent deps below) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config \ + re2c + +# persistent / runtime deps +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + xz-utils \ + ; \ + apt-get dist-clean + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC C28D937575603EB4ABB725861C0779DC5C0A9DE4 AFD8691FDAEDF03BDF6E460563F15A9B715376CA + +ENV PHP_VERSION 8.3.30 +ENV PHP_URL="https://www.php.net/distributions/php-8.3.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.3.30.tar.xz.asc" +ENV PHP_SHA256="67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libonig-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + --with-libdir="lib/$debMultiarch" \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ + | sort -u \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + apt-get dist-clean; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0-rc/buster/zts/docker-php-entrypoint b/8.3/trixie/zts/docker-php-entrypoint similarity index 100% rename from 8.0-rc/buster/zts/docker-php-entrypoint rename to 8.3/trixie/zts/docker-php-entrypoint diff --git a/8.0-rc/buster/zts/docker-php-ext-configure b/8.3/trixie/zts/docker-php-ext-configure similarity index 100% rename from 8.0-rc/buster/zts/docker-php-ext-configure rename to 8.3/trixie/zts/docker-php-ext-configure diff --git a/8.0-rc/buster/zts/docker-php-ext-enable b/8.3/trixie/zts/docker-php-ext-enable similarity index 100% rename from 8.0-rc/buster/zts/docker-php-ext-enable rename to 8.3/trixie/zts/docker-php-ext-enable diff --git a/8.3/trixie/zts/docker-php-ext-install b/8.3/trixie/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.3/trixie/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0-rc/buster/zts/docker-php-source b/8.3/trixie/zts/docker-php-source similarity index 100% rename from 8.0-rc/buster/zts/docker-php-source rename to 8.3/trixie/zts/docker-php-source diff --git a/8.0-rc/alpine3.15/cli/Dockerfile b/8.4/alpine3.22/cli/Dockerfile similarity index 81% rename from 8.0-rc/alpine3.15/cli/Dockerfile rename to 8.4/alpine3.22/cli/Dockerfile index b3e6739a9d..6f2c07a47d 100644 --- a/8.0-rc/alpine3.15/cli/Dockerfile +++ b/8.4/alpine3.22/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -157,9 +157,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -199,6 +196,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0/alpine3.15/cli/docker-php-entrypoint b/8.4/alpine3.22/cli/docker-php-entrypoint similarity index 100% rename from 8.0/alpine3.15/cli/docker-php-entrypoint rename to 8.4/alpine3.22/cli/docker-php-entrypoint diff --git a/8.0/alpine3.15/cli/docker-php-ext-configure b/8.4/alpine3.22/cli/docker-php-ext-configure similarity index 100% rename from 8.0/alpine3.15/cli/docker-php-ext-configure rename to 8.4/alpine3.22/cli/docker-php-ext-configure diff --git a/8.0/alpine3.15/cli/docker-php-ext-enable b/8.4/alpine3.22/cli/docker-php-ext-enable similarity index 100% rename from 8.0/alpine3.15/cli/docker-php-ext-enable rename to 8.4/alpine3.22/cli/docker-php-ext-enable diff --git a/8.4/alpine3.22/cli/docker-php-ext-install b/8.4/alpine3.22/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/alpine3.22/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/alpine3.15/cli/docker-php-source b/8.4/alpine3.22/cli/docker-php-source similarity index 100% rename from 8.0/alpine3.15/cli/docker-php-source rename to 8.4/alpine3.22/cli/docker-php-source diff --git a/7.4/alpine3.15/fpm/Dockerfile b/8.4/alpine3.22/fpm/Dockerfile similarity index 75% rename from 7.4/alpine3.15/fpm/Dockerfile rename to 8.4/alpine3.22/fpm/Dockerfile index 427bffd0ed..a79bdf0e31 100644 --- a/7.4/alpine3.15/fpm/Dockerfile +++ b/8.4/alpine3.22/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -107,19 +104,22 @@ RUN set -eux; \ \ # make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) rm -vf /usr/include/iconv.h; \ -# PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df - ln -sv /usr/include/gnu-libiconv/*.h /usr/include/; \ \ export \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -132,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -158,9 +156,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -206,6 +201,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -213,27 +211,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -241,14 +236,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0/alpine3.15/fpm/docker-php-entrypoint b/8.4/alpine3.22/fpm/docker-php-entrypoint similarity index 100% rename from 8.0/alpine3.15/fpm/docker-php-entrypoint rename to 8.4/alpine3.22/fpm/docker-php-entrypoint diff --git a/8.0/alpine3.15/fpm/docker-php-ext-configure b/8.4/alpine3.22/fpm/docker-php-ext-configure similarity index 100% rename from 8.0/alpine3.15/fpm/docker-php-ext-configure rename to 8.4/alpine3.22/fpm/docker-php-ext-configure diff --git a/8.0/alpine3.15/fpm/docker-php-ext-enable b/8.4/alpine3.22/fpm/docker-php-ext-enable similarity index 100% rename from 8.0/alpine3.15/fpm/docker-php-ext-enable rename to 8.4/alpine3.22/fpm/docker-php-ext-enable diff --git a/8.4/alpine3.22/fpm/docker-php-ext-install b/8.4/alpine3.22/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/alpine3.22/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/alpine3.15/fpm/docker-php-source b/8.4/alpine3.22/fpm/docker-php-source similarity index 100% rename from 8.0/alpine3.15/fpm/docker-php-source rename to 8.4/alpine3.22/fpm/docker-php-source diff --git a/8.4/alpine3.22/zts/Dockerfile b/8.4/alpine3.22/zts/Dockerfile new file mode 100644 index 0000000000..e65db318ca --- /dev/null +++ b/8.4/alpine3.22/zts/Dockerfile @@ -0,0 +1,213 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.22 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD + +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0/alpine3.15/zts/docker-php-entrypoint b/8.4/alpine3.22/zts/docker-php-entrypoint similarity index 100% rename from 8.0/alpine3.15/zts/docker-php-entrypoint rename to 8.4/alpine3.22/zts/docker-php-entrypoint diff --git a/8.0/alpine3.15/zts/docker-php-ext-configure b/8.4/alpine3.22/zts/docker-php-ext-configure similarity index 100% rename from 8.0/alpine3.15/zts/docker-php-ext-configure rename to 8.4/alpine3.22/zts/docker-php-ext-configure diff --git a/8.0/alpine3.15/zts/docker-php-ext-enable b/8.4/alpine3.22/zts/docker-php-ext-enable similarity index 100% rename from 8.0/alpine3.15/zts/docker-php-ext-enable rename to 8.4/alpine3.22/zts/docker-php-ext-enable diff --git a/8.4/alpine3.22/zts/docker-php-ext-install b/8.4/alpine3.22/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/alpine3.22/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/alpine3.15/zts/docker-php-source b/8.4/alpine3.22/zts/docker-php-source similarity index 100% rename from 8.0/alpine3.15/zts/docker-php-source rename to 8.4/alpine3.22/zts/docker-php-source diff --git a/8.0-rc/alpine3.16/cli/Dockerfile b/8.4/alpine3.23/cli/Dockerfile similarity index 81% rename from 8.0-rc/alpine3.16/cli/Dockerfile rename to 8.4/alpine3.23/cli/Dockerfile index 0c88a3d705..60b32090ad 100644 --- a/8.0-rc/alpine3.16/cli/Dockerfile +++ b/8.4/alpine3.23/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -157,9 +157,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -199,6 +196,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0/alpine3.16/cli/docker-php-entrypoint b/8.4/alpine3.23/cli/docker-php-entrypoint similarity index 100% rename from 8.0/alpine3.16/cli/docker-php-entrypoint rename to 8.4/alpine3.23/cli/docker-php-entrypoint diff --git a/8.0/alpine3.16/cli/docker-php-ext-configure b/8.4/alpine3.23/cli/docker-php-ext-configure similarity index 100% rename from 8.0/alpine3.16/cli/docker-php-ext-configure rename to 8.4/alpine3.23/cli/docker-php-ext-configure diff --git a/8.0/alpine3.16/cli/docker-php-ext-enable b/8.4/alpine3.23/cli/docker-php-ext-enable similarity index 100% rename from 8.0/alpine3.16/cli/docker-php-ext-enable rename to 8.4/alpine3.23/cli/docker-php-ext-enable diff --git a/8.4/alpine3.23/cli/docker-php-ext-install b/8.4/alpine3.23/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/alpine3.23/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/alpine3.16/cli/docker-php-source b/8.4/alpine3.23/cli/docker-php-source similarity index 100% rename from 8.0/alpine3.16/cli/docker-php-source rename to 8.4/alpine3.23/cli/docker-php-source diff --git a/8.0/alpine3.16/fpm/Dockerfile b/8.4/alpine3.23/fpm/Dockerfile similarity index 75% rename from 8.0/alpine3.16/fpm/Dockerfile rename to 8.4/alpine3.23/fpm/Dockerfile index c394af7424..b7de22456c 100644 --- a/8.0/alpine3.16/fpm/Dockerfile +++ b/8.4/alpine3.23/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -156,9 +156,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -204,6 +201,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -211,27 +211,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -239,14 +236,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0/alpine3.16/fpm/docker-php-entrypoint b/8.4/alpine3.23/fpm/docker-php-entrypoint similarity index 100% rename from 8.0/alpine3.16/fpm/docker-php-entrypoint rename to 8.4/alpine3.23/fpm/docker-php-entrypoint diff --git a/8.0/alpine3.16/fpm/docker-php-ext-configure b/8.4/alpine3.23/fpm/docker-php-ext-configure similarity index 100% rename from 8.0/alpine3.16/fpm/docker-php-ext-configure rename to 8.4/alpine3.23/fpm/docker-php-ext-configure diff --git a/8.0/alpine3.16/fpm/docker-php-ext-enable b/8.4/alpine3.23/fpm/docker-php-ext-enable similarity index 100% rename from 8.0/alpine3.16/fpm/docker-php-ext-enable rename to 8.4/alpine3.23/fpm/docker-php-ext-enable diff --git a/8.4/alpine3.23/fpm/docker-php-ext-install b/8.4/alpine3.23/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/alpine3.23/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/alpine3.16/fpm/docker-php-source b/8.4/alpine3.23/fpm/docker-php-source similarity index 100% rename from 8.0/alpine3.16/fpm/docker-php-source rename to 8.4/alpine3.23/fpm/docker-php-source diff --git a/8.4/alpine3.23/zts/Dockerfile b/8.4/alpine3.23/zts/Dockerfile new file mode 100644 index 0000000000..bae5e2c8fd --- /dev/null +++ b/8.4/alpine3.23/zts/Dockerfile @@ -0,0 +1,213 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.23 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD + +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0/alpine3.16/zts/docker-php-entrypoint b/8.4/alpine3.23/zts/docker-php-entrypoint similarity index 100% rename from 8.0/alpine3.16/zts/docker-php-entrypoint rename to 8.4/alpine3.23/zts/docker-php-entrypoint diff --git a/8.0/alpine3.16/zts/docker-php-ext-configure b/8.4/alpine3.23/zts/docker-php-ext-configure similarity index 100% rename from 8.0/alpine3.16/zts/docker-php-ext-configure rename to 8.4/alpine3.23/zts/docker-php-ext-configure diff --git a/8.0/alpine3.16/zts/docker-php-ext-enable b/8.4/alpine3.23/zts/docker-php-ext-enable similarity index 100% rename from 8.0/alpine3.16/zts/docker-php-ext-enable rename to 8.4/alpine3.23/zts/docker-php-ext-enable diff --git a/8.4/alpine3.23/zts/docker-php-ext-install b/8.4/alpine3.23/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/alpine3.23/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/alpine3.16/zts/docker-php-source b/8.4/alpine3.23/zts/docker-php-source similarity index 100% rename from 8.0/alpine3.16/zts/docker-php-source rename to 8.4/alpine3.23/zts/docker-php-source diff --git a/7.4/bullseye/apache/Dockerfile b/8.4/bookworm/apache/Dockerfile similarity index 82% rename from 7.4/bullseye/apache/Dockerfile rename to 8.4/bookworm/apache/Dockerfile index c71a4e7470..377a43b982 100644 --- a/7.4/bullseye/apache/Dockerfile +++ b/8.4/bookworm/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -116,17 +118,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,10 +257,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -276,6 +277,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0/bullseye/apache/apache2-foreground b/8.4/bookworm/apache/apache2-foreground similarity index 100% rename from 8.0/bullseye/apache/apache2-foreground rename to 8.4/bookworm/apache/apache2-foreground diff --git a/8.0/bullseye/apache/docker-php-entrypoint b/8.4/bookworm/apache/docker-php-entrypoint similarity index 100% rename from 8.0/bullseye/apache/docker-php-entrypoint rename to 8.4/bookworm/apache/docker-php-entrypoint diff --git a/8.0/bullseye/apache/docker-php-ext-configure b/8.4/bookworm/apache/docker-php-ext-configure similarity index 100% rename from 8.0/bullseye/apache/docker-php-ext-configure rename to 8.4/bookworm/apache/docker-php-ext-configure diff --git a/8.0/bullseye/apache/docker-php-ext-enable b/8.4/bookworm/apache/docker-php-ext-enable similarity index 100% rename from 8.0/bullseye/apache/docker-php-ext-enable rename to 8.4/bookworm/apache/docker-php-ext-enable diff --git a/8.4/bookworm/apache/docker-php-ext-install b/8.4/bookworm/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/bookworm/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/bullseye/apache/docker-php-source b/8.4/bookworm/apache/docker-php-source similarity index 100% rename from 8.0/bullseye/apache/docker-php-source rename to 8.4/bookworm/apache/docker-php-source diff --git a/7.4/buster/cli/Dockerfile b/8.4/bookworm/cli/Dockerfile similarity index 79% rename from 7.4/buster/cli/Dockerfile rename to 8.4/bookworm/cli/Dockerfile index e37be35057..cefdd59775 100644 --- a/7.4/buster/cli/Dockerfile +++ b/8.4/bookworm/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,9 +168,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 @@ -198,10 +196,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -217,6 +216,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0/bullseye/cli/docker-php-entrypoint b/8.4/bookworm/cli/docker-php-entrypoint similarity index 100% rename from 8.0/bullseye/cli/docker-php-entrypoint rename to 8.4/bookworm/cli/docker-php-entrypoint diff --git a/8.0/bullseye/cli/docker-php-ext-configure b/8.4/bookworm/cli/docker-php-ext-configure similarity index 100% rename from 8.0/bullseye/cli/docker-php-ext-configure rename to 8.4/bookworm/cli/docker-php-ext-configure diff --git a/8.0/bullseye/cli/docker-php-ext-enable b/8.4/bookworm/cli/docker-php-ext-enable similarity index 100% rename from 8.0/bullseye/cli/docker-php-ext-enable rename to 8.4/bookworm/cli/docker-php-ext-enable diff --git a/8.4/bookworm/cli/docker-php-ext-install b/8.4/bookworm/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/bookworm/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/bullseye/cli/docker-php-source b/8.4/bookworm/cli/docker-php-source similarity index 100% rename from 8.0/bullseye/cli/docker-php-source rename to 8.4/bookworm/cli/docker-php-source diff --git a/8.0/bullseye/fpm/Dockerfile b/8.4/bookworm/fpm/Dockerfile similarity index 72% rename from 8.0/bullseye/fpm/Dockerfile rename to 8.4/bookworm/fpm/Dockerfile index be8a17871d..39d1f4fa6a 100644 --- a/8.0/bullseye/fpm/Dockerfile +++ b/8.4/bookworm/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,10 +198,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -219,6 +218,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -226,27 +228,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -254,14 +253,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0/bullseye/fpm/docker-php-entrypoint b/8.4/bookworm/fpm/docker-php-entrypoint similarity index 100% rename from 8.0/bullseye/fpm/docker-php-entrypoint rename to 8.4/bookworm/fpm/docker-php-entrypoint diff --git a/8.0/bullseye/fpm/docker-php-ext-configure b/8.4/bookworm/fpm/docker-php-ext-configure similarity index 100% rename from 8.0/bullseye/fpm/docker-php-ext-configure rename to 8.4/bookworm/fpm/docker-php-ext-configure diff --git a/8.0/bullseye/fpm/docker-php-ext-enable b/8.4/bookworm/fpm/docker-php-ext-enable similarity index 100% rename from 8.0/bullseye/fpm/docker-php-ext-enable rename to 8.4/bookworm/fpm/docker-php-ext-enable diff --git a/8.4/bookworm/fpm/docker-php-ext-install b/8.4/bookworm/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/bookworm/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/bullseye/fpm/docker-php-source b/8.4/bookworm/fpm/docker-php-source similarity index 100% rename from 8.0/bullseye/fpm/docker-php-source rename to 8.4/bookworm/fpm/docker-php-source diff --git a/8.4/bookworm/zts/Dockerfile b/8.4/bookworm/zts/Dockerfile new file mode 100644 index 0000000000..80b9856980 --- /dev/null +++ b/8.4/bookworm/zts/Dockerfile @@ -0,0 +1,230 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:bookworm-slim + +# prevent Debian's PHP packages from being installed +# https://github.com/docker-library/php/pull/542 +RUN set -eux; \ + { \ + echo 'Package: php*'; \ + echo 'Pin: release *'; \ + echo 'Pin-Priority: -1'; \ + } > /etc/apt/preferences.d/no-debian-php + +# dependencies required for running "phpize" +# (see persistent deps below) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config \ + re2c + +# persistent / runtime deps +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + xz-utils \ + ; \ + rm -rf /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD + +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libonig-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + --with-libdir="lib/$debMultiarch" \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ + | sort -u \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0/bullseye/zts/docker-php-entrypoint b/8.4/bookworm/zts/docker-php-entrypoint similarity index 100% rename from 8.0/bullseye/zts/docker-php-entrypoint rename to 8.4/bookworm/zts/docker-php-entrypoint diff --git a/8.0/bullseye/zts/docker-php-ext-configure b/8.4/bookworm/zts/docker-php-ext-configure similarity index 100% rename from 8.0/bullseye/zts/docker-php-ext-configure rename to 8.4/bookworm/zts/docker-php-ext-configure diff --git a/8.0/bullseye/zts/docker-php-ext-enable b/8.4/bookworm/zts/docker-php-ext-enable similarity index 100% rename from 8.0/bullseye/zts/docker-php-ext-enable rename to 8.4/bookworm/zts/docker-php-ext-enable diff --git a/8.4/bookworm/zts/docker-php-ext-install b/8.4/bookworm/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/bookworm/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/bullseye/zts/docker-php-source b/8.4/bookworm/zts/docker-php-source similarity index 100% rename from 8.0/bullseye/zts/docker-php-source rename to 8.4/bookworm/zts/docker-php-source diff --git a/7.4/buster/apache/Dockerfile b/8.4/trixie/apache/Dockerfile similarity index 81% rename from 7.4/buster/apache/Dockerfile rename to 8.4/trixie/apache/Dockerfile index 16d41d2581..931ed36d30 100644 --- a/7.4/buster/apache/Dockerfile +++ b/8.4/trixie/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -54,7 +54,7 @@ ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends apache2; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # generically convert lines like # export APACHE_RUN_USER=www-data @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -116,18 +118,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,15 +257,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -276,6 +277,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium diff --git a/8.0/buster/apache/apache2-foreground b/8.4/trixie/apache/apache2-foreground similarity index 100% rename from 8.0/buster/apache/apache2-foreground rename to 8.4/trixie/apache/apache2-foreground diff --git a/8.0/buster/apache/docker-php-entrypoint b/8.4/trixie/apache/docker-php-entrypoint similarity index 100% rename from 8.0/buster/apache/docker-php-entrypoint rename to 8.4/trixie/apache/docker-php-entrypoint diff --git a/8.0/buster/apache/docker-php-ext-configure b/8.4/trixie/apache/docker-php-ext-configure similarity index 100% rename from 8.0/buster/apache/docker-php-ext-configure rename to 8.4/trixie/apache/docker-php-ext-configure diff --git a/8.0/buster/apache/docker-php-ext-enable b/8.4/trixie/apache/docker-php-ext-enable similarity index 100% rename from 8.0/buster/apache/docker-php-ext-enable rename to 8.4/trixie/apache/docker-php-ext-enable diff --git a/8.4/trixie/apache/docker-php-ext-install b/8.4/trixie/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/trixie/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/buster/apache/docker-php-source b/8.4/trixie/apache/docker-php-source similarity index 100% rename from 8.0/buster/apache/docker-php-source rename to 8.4/trixie/apache/docker-php-source diff --git a/8.4/trixie/cli/Dockerfile b/8.4/trixie/cli/Dockerfile new file mode 100644 index 0000000000..e7aaa25cce --- /dev/null +++ b/8.4/trixie/cli/Dockerfile @@ -0,0 +1,226 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:trixie-slim + +# prevent Debian's PHP packages from being installed +# https://github.com/docker-library/php/pull/542 +RUN set -eux; \ + { \ + echo 'Package: php*'; \ + echo 'Pin: release *'; \ + echo 'Pin-Priority: -1'; \ + } > /etc/apt/preferences.d/no-debian-php + +# dependencies required for running "phpize" +# (see persistent deps below) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config \ + re2c + +# persistent / runtime deps +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + xz-utils \ + ; \ + apt-get dist-clean + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD + +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libonig-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + --with-libdir="lib/$debMultiarch" \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ + | sort -u \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + apt-get dist-clean; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0/buster/cli/docker-php-entrypoint b/8.4/trixie/cli/docker-php-entrypoint similarity index 100% rename from 8.0/buster/cli/docker-php-entrypoint rename to 8.4/trixie/cli/docker-php-entrypoint diff --git a/8.0/buster/cli/docker-php-ext-configure b/8.4/trixie/cli/docker-php-ext-configure similarity index 100% rename from 8.0/buster/cli/docker-php-ext-configure rename to 8.4/trixie/cli/docker-php-ext-configure diff --git a/8.0/buster/cli/docker-php-ext-enable b/8.4/trixie/cli/docker-php-ext-enable similarity index 100% rename from 8.0/buster/cli/docker-php-ext-enable rename to 8.4/trixie/cli/docker-php-ext-enable diff --git a/8.4/trixie/cli/docker-php-ext-install b/8.4/trixie/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/trixie/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/buster/cli/docker-php-source b/8.4/trixie/cli/docker-php-source similarity index 100% rename from 8.0/buster/cli/docker-php-source rename to 8.4/trixie/cli/docker-php-source diff --git a/8.0/buster/fpm/Dockerfile b/8.4/trixie/fpm/Dockerfile similarity index 72% rename from 8.0/buster/fpm/Dockerfile rename to 8.4/trixie/fpm/Dockerfile index 104bfc8069..87fb1c3dd4 100644 --- a/8.0/buster/fpm/Dockerfile +++ b/8.4/trixie/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,18 +58,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD -ENV PHP_VERSION 8.0.20 -ENV PHP_URL="https://www.php.net/distributions/php-8.0.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.0.20.tar.xz.asc" -ENV PHP_SHA256="973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b" +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,15 +198,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -219,6 +218,9 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium @@ -226,27 +228,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -254,14 +253,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.0/buster/fpm/docker-php-entrypoint b/8.4/trixie/fpm/docker-php-entrypoint similarity index 100% rename from 8.0/buster/fpm/docker-php-entrypoint rename to 8.4/trixie/fpm/docker-php-entrypoint diff --git a/8.0/buster/fpm/docker-php-ext-configure b/8.4/trixie/fpm/docker-php-ext-configure similarity index 100% rename from 8.0/buster/fpm/docker-php-ext-configure rename to 8.4/trixie/fpm/docker-php-ext-configure diff --git a/8.0/buster/fpm/docker-php-ext-enable b/8.4/trixie/fpm/docker-php-ext-enable similarity index 100% rename from 8.0/buster/fpm/docker-php-ext-enable rename to 8.4/trixie/fpm/docker-php-ext-enable diff --git a/8.4/trixie/fpm/docker-php-ext-install b/8.4/trixie/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/trixie/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/buster/fpm/docker-php-source b/8.4/trixie/fpm/docker-php-source similarity index 100% rename from 8.0/buster/fpm/docker-php-source rename to 8.4/trixie/fpm/docker-php-source diff --git a/8.4/trixie/zts/Dockerfile b/8.4/trixie/zts/Dockerfile new file mode 100644 index 0000000000..7d287f8e6f --- /dev/null +++ b/8.4/trixie/zts/Dockerfile @@ -0,0 +1,230 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:trixie-slim + +# prevent Debian's PHP packages from being installed +# https://github.com/docker-library/php/pull/542 +RUN set -eux; \ + { \ + echo 'Package: php*'; \ + echo 'Pin: release *'; \ + echo 'Pin-Priority: -1'; \ + } > /etc/apt/preferences.d/no-debian-php + +# dependencies required for running "phpize" +# (see persistent deps below) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config \ + re2c + +# persistent / runtime deps +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + xz-utils \ + ; \ + apt-get dist-clean + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS AFD8691FDAEDF03BDF6E460563F15A9B715376CA 9D7F99A0CB8F05C8A6958D6256A97AF7600A39A6 0616E93D95AF471243E26761770426E17EBBB3DD + +ENV PHP_VERSION 8.4.20 +ENV PHP_URL="https://www.php.net/distributions/php-8.4.20.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.4.20.tar.xz.asc" +ENV PHP_SHA256="e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libonig-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + --with-libdir="lib/$debMultiarch" \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ + | sort -u \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + apt-get dist-clean; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.0/buster/zts/docker-php-entrypoint b/8.4/trixie/zts/docker-php-entrypoint similarity index 100% rename from 8.0/buster/zts/docker-php-entrypoint rename to 8.4/trixie/zts/docker-php-entrypoint diff --git a/8.0/buster/zts/docker-php-ext-configure b/8.4/trixie/zts/docker-php-ext-configure similarity index 100% rename from 8.0/buster/zts/docker-php-ext-configure rename to 8.4/trixie/zts/docker-php-ext-configure diff --git a/8.0/buster/zts/docker-php-ext-enable b/8.4/trixie/zts/docker-php-ext-enable similarity index 100% rename from 8.0/buster/zts/docker-php-ext-enable rename to 8.4/trixie/zts/docker-php-ext-enable diff --git a/8.4/trixie/zts/docker-php-ext-install b/8.4/trixie/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.4/trixie/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.0/buster/zts/docker-php-source b/8.4/trixie/zts/docker-php-source similarity index 100% rename from 8.0/buster/zts/docker-php-source rename to 8.4/trixie/zts/docker-php-source diff --git a/8.5/alpine3.22/cli/Dockerfile b/8.5/alpine3.22/cli/Dockerfile new file mode 100644 index 0000000000..95831dda3c --- /dev/null +++ b/8.5/alpine3.22/cli/Dockerfile @@ -0,0 +1,203 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.22 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 + +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.1/alpine3.15/cli/docker-php-entrypoint b/8.5/alpine3.22/cli/docker-php-entrypoint similarity index 100% rename from 8.1/alpine3.15/cli/docker-php-entrypoint rename to 8.5/alpine3.22/cli/docker-php-entrypoint diff --git a/8.1/alpine3.15/cli/docker-php-ext-configure b/8.5/alpine3.22/cli/docker-php-ext-configure similarity index 100% rename from 8.1/alpine3.15/cli/docker-php-ext-configure rename to 8.5/alpine3.22/cli/docker-php-ext-configure diff --git a/8.1/alpine3.15/cli/docker-php-ext-enable b/8.5/alpine3.22/cli/docker-php-ext-enable similarity index 100% rename from 8.1/alpine3.15/cli/docker-php-ext-enable rename to 8.5/alpine3.22/cli/docker-php-ext-enable diff --git a/8.5/alpine3.22/cli/docker-php-ext-install b/8.5/alpine3.22/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/alpine3.22/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/alpine3.15/cli/docker-php-source b/8.5/alpine3.22/cli/docker-php-source similarity index 100% rename from 8.1/alpine3.15/cli/docker-php-source rename to 8.5/alpine3.22/cli/docker-php-source diff --git a/8.1/alpine3.15/fpm/Dockerfile b/8.5/alpine3.22/fpm/Dockerfile similarity index 76% rename from 8.1/alpine3.15/fpm/Dockerfile rename to 8.5/alpine3.22/fpm/Dockerfile index 8bf9450330..63d45906e0 100644 --- a/8.1/alpine3.15/fpm/Dockerfile +++ b/8.5/alpine3.22/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.15 +FROM alpine:3.22 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -156,9 +156,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -211,27 +208,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -239,14 +233,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.1/alpine3.15/fpm/docker-php-entrypoint b/8.5/alpine3.22/fpm/docker-php-entrypoint similarity index 100% rename from 8.1/alpine3.15/fpm/docker-php-entrypoint rename to 8.5/alpine3.22/fpm/docker-php-entrypoint diff --git a/8.1/alpine3.15/fpm/docker-php-ext-configure b/8.5/alpine3.22/fpm/docker-php-ext-configure similarity index 100% rename from 8.1/alpine3.15/fpm/docker-php-ext-configure rename to 8.5/alpine3.22/fpm/docker-php-ext-configure diff --git a/8.1/alpine3.15/fpm/docker-php-ext-enable b/8.5/alpine3.22/fpm/docker-php-ext-enable similarity index 100% rename from 8.1/alpine3.15/fpm/docker-php-ext-enable rename to 8.5/alpine3.22/fpm/docker-php-ext-enable diff --git a/8.5/alpine3.22/fpm/docker-php-ext-install b/8.5/alpine3.22/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/alpine3.22/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/alpine3.15/fpm/docker-php-source b/8.5/alpine3.22/fpm/docker-php-source similarity index 100% rename from 8.1/alpine3.15/fpm/docker-php-source rename to 8.5/alpine3.22/fpm/docker-php-source diff --git a/8.5/alpine3.22/zts/Dockerfile b/8.5/alpine3.22/zts/Dockerfile new file mode 100644 index 0000000000..e3d42fb07d --- /dev/null +++ b/8.5/alpine3.22/zts/Dockerfile @@ -0,0 +1,210 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.22 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 + +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.1/alpine3.15/zts/docker-php-entrypoint b/8.5/alpine3.22/zts/docker-php-entrypoint similarity index 100% rename from 8.1/alpine3.15/zts/docker-php-entrypoint rename to 8.5/alpine3.22/zts/docker-php-entrypoint diff --git a/8.1/alpine3.15/zts/docker-php-ext-configure b/8.5/alpine3.22/zts/docker-php-ext-configure similarity index 100% rename from 8.1/alpine3.15/zts/docker-php-ext-configure rename to 8.5/alpine3.22/zts/docker-php-ext-configure diff --git a/8.1/alpine3.15/zts/docker-php-ext-enable b/8.5/alpine3.22/zts/docker-php-ext-enable similarity index 100% rename from 8.1/alpine3.15/zts/docker-php-ext-enable rename to 8.5/alpine3.22/zts/docker-php-ext-enable diff --git a/8.5/alpine3.22/zts/docker-php-ext-install b/8.5/alpine3.22/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/alpine3.22/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/alpine3.15/zts/docker-php-source b/8.5/alpine3.22/zts/docker-php-source similarity index 100% rename from 8.1/alpine3.15/zts/docker-php-source rename to 8.5/alpine3.22/zts/docker-php-source diff --git a/8.5/alpine3.23/cli/Dockerfile b/8.5/alpine3.23/cli/Dockerfile new file mode 100644 index 0000000000..4a4b6d0e98 --- /dev/null +++ b/8.5/alpine3.23/cli/Dockerfile @@ -0,0 +1,203 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.23 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 + +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.1/alpine3.16/cli/docker-php-entrypoint b/8.5/alpine3.23/cli/docker-php-entrypoint similarity index 100% rename from 8.1/alpine3.16/cli/docker-php-entrypoint rename to 8.5/alpine3.23/cli/docker-php-entrypoint diff --git a/8.1/alpine3.16/cli/docker-php-ext-configure b/8.5/alpine3.23/cli/docker-php-ext-configure similarity index 100% rename from 8.1/alpine3.16/cli/docker-php-ext-configure rename to 8.5/alpine3.23/cli/docker-php-ext-configure diff --git a/8.1/alpine3.16/cli/docker-php-ext-enable b/8.5/alpine3.23/cli/docker-php-ext-enable similarity index 100% rename from 8.1/alpine3.16/cli/docker-php-ext-enable rename to 8.5/alpine3.23/cli/docker-php-ext-enable diff --git a/8.5/alpine3.23/cli/docker-php-ext-install b/8.5/alpine3.23/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/alpine3.23/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/alpine3.16/cli/docker-php-source b/8.5/alpine3.23/cli/docker-php-source similarity index 100% rename from 8.1/alpine3.16/cli/docker-php-source rename to 8.5/alpine3.23/cli/docker-php-source diff --git a/8.1/alpine3.16/fpm/Dockerfile b/8.5/alpine3.23/fpm/Dockerfile similarity index 76% rename from 8.1/alpine3.16/fpm/Dockerfile rename to 8.5/alpine3.23/fpm/Dockerfile index 3bddbde317..745bd86347 100644 --- a/8.1/alpine3.16/fpm/Dockerfile +++ b/8.5/alpine3.23/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM alpine:3.16 +FROM alpine:3.23 # dependencies required for running "phpize" # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) @@ -23,10 +23,9 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ @@ -43,7 +42,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -55,11 +54,11 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ @@ -74,16 +73,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apk del --no-network .fetch-deps @@ -112,12 +109,17 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -130,8 +132,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -156,9 +156,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ \ --disable-cgi \ \ @@ -211,27 +208,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -239,14 +233,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.1/alpine3.16/fpm/docker-php-entrypoint b/8.5/alpine3.23/fpm/docker-php-entrypoint similarity index 100% rename from 8.1/alpine3.16/fpm/docker-php-entrypoint rename to 8.5/alpine3.23/fpm/docker-php-entrypoint diff --git a/8.1/alpine3.16/fpm/docker-php-ext-configure b/8.5/alpine3.23/fpm/docker-php-ext-configure similarity index 100% rename from 8.1/alpine3.16/fpm/docker-php-ext-configure rename to 8.5/alpine3.23/fpm/docker-php-ext-configure diff --git a/8.1/alpine3.16/fpm/docker-php-ext-enable b/8.5/alpine3.23/fpm/docker-php-ext-enable similarity index 100% rename from 8.1/alpine3.16/fpm/docker-php-ext-enable rename to 8.5/alpine3.23/fpm/docker-php-ext-enable diff --git a/8.5/alpine3.23/fpm/docker-php-ext-install b/8.5/alpine3.23/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/alpine3.23/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/alpine3.16/fpm/docker-php-source b/8.5/alpine3.23/fpm/docker-php-source similarity index 100% rename from 8.1/alpine3.16/fpm/docker-php-source rename to 8.5/alpine3.23/fpm/docker-php-source diff --git a/8.5/alpine3.23/zts/Dockerfile b/8.5/alpine3.23/zts/Dockerfile new file mode 100644 index 0000000000..e76c293e78 --- /dev/null +++ b/8.5/alpine3.23/zts/Dockerfile @@ -0,0 +1,210 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.23 + +# dependencies required for running "phpize" +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkgconf \ + re2c + +# persistent / runtime deps +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl \ + tar \ + xz + +# ensure www-data user exists +RUN set -eux; \ + adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.14-stable +# https://git.alpinelinux.org/aports/tree/main/nginx/nginx.pre-install?h=3.14-stable + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 1777 /var/www/html + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 + +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" + +RUN set -eux; \ + \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + \ + apk del --no-network .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + argon2-dev \ + coreutils \ + curl-dev \ + gnu-libiconv-dev \ + libsodium-dev \ + libxml2-dev \ + linux-headers \ + oniguruma-dev \ + openssl-dev \ + readline-dev \ + sqlite-dev \ + ; \ + \ +# make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + rm -vf /usr/include/iconv.h; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ + ./configure \ + --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors instead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# https://github.com/docker-library/php/issues/822 + --with-pic \ + \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-iconv=/usr \ + --with-openssl \ + --with-readline \ + --with-zlib \ + \ +# https://github.com/docker-library/php/pull/1259 + --enable-phpdbg \ + --enable-phpdbg-readline \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") + --with-pear \ + \ + \ +# https://github.com/docker-library/php/pull/939#issuecomment-730501748 + --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find \ + /usr/local \ + -type f \ + -perm '/0111' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : \ + ' -- '{}' + \ + ; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --no-cache $runDeps; \ + \ + apk del --no-network .build-deps; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] diff --git a/8.1/alpine3.16/zts/docker-php-entrypoint b/8.5/alpine3.23/zts/docker-php-entrypoint similarity index 100% rename from 8.1/alpine3.16/zts/docker-php-entrypoint rename to 8.5/alpine3.23/zts/docker-php-entrypoint diff --git a/8.1/alpine3.16/zts/docker-php-ext-configure b/8.5/alpine3.23/zts/docker-php-ext-configure similarity index 100% rename from 8.1/alpine3.16/zts/docker-php-ext-configure rename to 8.5/alpine3.23/zts/docker-php-ext-configure diff --git a/8.1/alpine3.16/zts/docker-php-ext-enable b/8.5/alpine3.23/zts/docker-php-ext-enable similarity index 100% rename from 8.1/alpine3.16/zts/docker-php-ext-enable rename to 8.5/alpine3.23/zts/docker-php-ext-enable diff --git a/8.5/alpine3.23/zts/docker-php-ext-install b/8.5/alpine3.23/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/alpine3.23/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/alpine3.16/zts/docker-php-source b/8.5/alpine3.23/zts/docker-php-source similarity index 100% rename from 8.1/alpine3.16/zts/docker-php-source rename to 8.5/alpine3.23/zts/docker-php-source diff --git a/8.1/bullseye/apache/Dockerfile b/8.5/bookworm/apache/Dockerfile similarity index 83% rename from 8.1/bullseye/apache/Dockerfile rename to 8.5/bookworm/apache/Dockerfile index d4bd3be750..2cfd76e244 100644 --- a/8.1/bullseye/apache/Dockerfile +++ b/8.5/bookworm/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -116,17 +118,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,10 +257,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ diff --git a/8.1/bullseye/apache/apache2-foreground b/8.5/bookworm/apache/apache2-foreground similarity index 100% rename from 8.1/bullseye/apache/apache2-foreground rename to 8.5/bookworm/apache/apache2-foreground diff --git a/8.1/bullseye/apache/docker-php-entrypoint b/8.5/bookworm/apache/docker-php-entrypoint similarity index 100% rename from 8.1/bullseye/apache/docker-php-entrypoint rename to 8.5/bookworm/apache/docker-php-entrypoint diff --git a/8.1/bullseye/apache/docker-php-ext-configure b/8.5/bookworm/apache/docker-php-ext-configure similarity index 100% rename from 8.1/bullseye/apache/docker-php-ext-configure rename to 8.5/bookworm/apache/docker-php-ext-configure diff --git a/8.1/bullseye/apache/docker-php-ext-enable b/8.5/bookworm/apache/docker-php-ext-enable similarity index 100% rename from 8.1/bullseye/apache/docker-php-ext-enable rename to 8.5/bookworm/apache/docker-php-ext-enable diff --git a/8.5/bookworm/apache/docker-php-ext-install b/8.5/bookworm/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/bookworm/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/bullseye/apache/docker-php-source b/8.5/bookworm/apache/docker-php-source similarity index 100% rename from 8.1/bullseye/apache/docker-php-source rename to 8.5/bookworm/apache/docker-php-source diff --git a/8.1/bullseye/cli/Dockerfile b/8.5/bookworm/cli/Dockerfile similarity index 80% rename from 8.1/bullseye/cli/Dockerfile rename to 8.5/bookworm/cli/Dockerfile index 642b3fc6ae..6f0fe0044e 100644 --- a/8.1/bullseye/cli/Dockerfile +++ b/8.5/bookworm/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,9 +168,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 @@ -198,10 +196,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ diff --git a/8.1/bullseye/cli/docker-php-entrypoint b/8.5/bookworm/cli/docker-php-entrypoint similarity index 100% rename from 8.1/bullseye/cli/docker-php-entrypoint rename to 8.5/bookworm/cli/docker-php-entrypoint diff --git a/8.1/bullseye/cli/docker-php-ext-configure b/8.5/bookworm/cli/docker-php-ext-configure similarity index 100% rename from 8.1/bullseye/cli/docker-php-ext-configure rename to 8.5/bookworm/cli/docker-php-ext-configure diff --git a/8.1/bullseye/cli/docker-php-ext-enable b/8.5/bookworm/cli/docker-php-ext-enable similarity index 100% rename from 8.1/bullseye/cli/docker-php-ext-enable rename to 8.5/bookworm/cli/docker-php-ext-enable diff --git a/8.5/bookworm/cli/docker-php-ext-install b/8.5/bookworm/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/bookworm/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/bullseye/cli/docker-php-source b/8.5/bookworm/cli/docker-php-source similarity index 100% rename from 8.1/bullseye/cli/docker-php-source rename to 8.5/bookworm/cli/docker-php-source diff --git a/8.1/bullseye/fpm/Dockerfile b/8.5/bookworm/fpm/Dockerfile similarity index 73% rename from 8.1/bullseye/fpm/Dockerfile rename to 8.5/bookworm/fpm/Dockerfile index 2c803d7415..6319c77581 100644 --- a/8.1/bullseye/fpm/Dockerfile +++ b/8.5/bookworm/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,10 +198,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ @@ -226,27 +225,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -254,14 +250,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.1/bullseye/fpm/docker-php-entrypoint b/8.5/bookworm/fpm/docker-php-entrypoint similarity index 100% rename from 8.1/bullseye/fpm/docker-php-entrypoint rename to 8.5/bookworm/fpm/docker-php-entrypoint diff --git a/8.1/bullseye/fpm/docker-php-ext-configure b/8.5/bookworm/fpm/docker-php-ext-configure similarity index 100% rename from 8.1/bullseye/fpm/docker-php-ext-configure rename to 8.5/bookworm/fpm/docker-php-ext-configure diff --git a/8.1/bullseye/fpm/docker-php-ext-enable b/8.5/bookworm/fpm/docker-php-ext-enable similarity index 100% rename from 8.1/bullseye/fpm/docker-php-ext-enable rename to 8.5/bookworm/fpm/docker-php-ext-enable diff --git a/8.5/bookworm/fpm/docker-php-ext-install b/8.5/bookworm/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/bookworm/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/bullseye/fpm/docker-php-source b/8.5/bookworm/fpm/docker-php-source similarity index 100% rename from 8.1/bullseye/fpm/docker-php-source rename to 8.5/bookworm/fpm/docker-php-source diff --git a/8.1/buster/cli/Dockerfile b/8.5/bookworm/zts/Dockerfile similarity index 79% rename from 8.1/buster/cli/Dockerfile rename to 8.5/bookworm/zts/Dockerfile index 6762cc1cbc..fd4a294f02 100644 --- a/8.1/buster/cli/Dockerfile +++ b/8.5/bookworm/zts/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:bookworm-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,17 +58,17 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ + apt-get install -y --no-install-recommends gnupg; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,13 +168,14 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -198,10 +200,11 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ diff --git a/8.1/bullseye/zts/docker-php-entrypoint b/8.5/bookworm/zts/docker-php-entrypoint similarity index 100% rename from 8.1/bullseye/zts/docker-php-entrypoint rename to 8.5/bookworm/zts/docker-php-entrypoint diff --git a/8.1/bullseye/zts/docker-php-ext-configure b/8.5/bookworm/zts/docker-php-ext-configure similarity index 100% rename from 8.1/bullseye/zts/docker-php-ext-configure rename to 8.5/bookworm/zts/docker-php-ext-configure diff --git a/8.1/bullseye/zts/docker-php-ext-enable b/8.5/bookworm/zts/docker-php-ext-enable similarity index 100% rename from 8.1/bullseye/zts/docker-php-ext-enable rename to 8.5/bookworm/zts/docker-php-ext-enable diff --git a/8.5/bookworm/zts/docker-php-ext-install b/8.5/bookworm/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/bookworm/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/bullseye/zts/docker-php-source b/8.5/bookworm/zts/docker-php-source similarity index 100% rename from 8.1/bullseye/zts/docker-php-source rename to 8.5/bookworm/zts/docker-php-source diff --git a/8.1/buster/apache/Dockerfile b/8.5/trixie/apache/Dockerfile similarity index 82% rename from 8.1/buster/apache/Dockerfile rename to 8.5/trixie/apache/Dockerfile index ebc03960f8..bb39d5036a 100644 --- a/8.1/buster/apache/Dockerfile +++ b/8.5/trixie/apache/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -54,7 +54,7 @@ ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends apache2; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # generically convert lines like # export APACHE_RUN_USER=www-data @@ -70,12 +70,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -116,18 +118,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -138,16 +140,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -176,6 +176,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -185,8 +188,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -199,8 +204,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -225,9 +228,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -257,15 +257,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ diff --git a/8.1/buster/apache/apache2-foreground b/8.5/trixie/apache/apache2-foreground similarity index 100% rename from 8.1/buster/apache/apache2-foreground rename to 8.5/trixie/apache/apache2-foreground diff --git a/8.1/buster/apache/docker-php-entrypoint b/8.5/trixie/apache/docker-php-entrypoint similarity index 100% rename from 8.1/buster/apache/docker-php-entrypoint rename to 8.5/trixie/apache/docker-php-entrypoint diff --git a/8.1/buster/apache/docker-php-ext-configure b/8.5/trixie/apache/docker-php-ext-configure similarity index 100% rename from 8.1/buster/apache/docker-php-ext-configure rename to 8.5/trixie/apache/docker-php-ext-configure diff --git a/8.1/buster/apache/docker-php-ext-enable b/8.5/trixie/apache/docker-php-ext-enable similarity index 100% rename from 8.1/buster/apache/docker-php-ext-enable rename to 8.5/trixie/apache/docker-php-ext-enable diff --git a/8.5/trixie/apache/docker-php-ext-install b/8.5/trixie/apache/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/trixie/apache/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/buster/apache/docker-php-source b/8.5/trixie/apache/docker-php-source similarity index 100% rename from 8.1/buster/apache/docker-php-source rename to 8.5/trixie/apache/docker-php-source diff --git a/7.4/bullseye/cli/Dockerfile b/8.5/trixie/cli/Dockerfile similarity index 79% rename from 7.4/bullseye/cli/Dockerfile rename to 8.5/trixie/cli/Dockerfile index 1fe23431b8..9ea9f87eaa 100644 --- a/7.4/bullseye/cli/Dockerfile +++ b/8.5/trixie/cli/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,18 +58,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312 +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 7.4.30 -ENV PHP_URL="https://www.php.net/distributions/php-7.4.30.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-7.4.30.tar.xz.asc" -ENV PHP_SHA256="ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,9 +168,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 @@ -198,15 +196,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ diff --git a/8.1/buster/cli/docker-php-entrypoint b/8.5/trixie/cli/docker-php-entrypoint similarity index 100% rename from 8.1/buster/cli/docker-php-entrypoint rename to 8.5/trixie/cli/docker-php-entrypoint diff --git a/8.1/buster/cli/docker-php-ext-configure b/8.5/trixie/cli/docker-php-ext-configure similarity index 100% rename from 8.1/buster/cli/docker-php-ext-configure rename to 8.5/trixie/cli/docker-php-ext-configure diff --git a/8.1/buster/cli/docker-php-ext-enable b/8.5/trixie/cli/docker-php-ext-enable similarity index 100% rename from 8.1/buster/cli/docker-php-ext-enable rename to 8.5/trixie/cli/docker-php-ext-enable diff --git a/8.5/trixie/cli/docker-php-ext-install b/8.5/trixie/cli/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/trixie/cli/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/buster/cli/docker-php-source b/8.5/trixie/cli/docker-php-source similarity index 100% rename from 8.1/buster/cli/docker-php-source rename to 8.5/trixie/cli/docker-php-source diff --git a/8.1/buster/fpm/Dockerfile b/8.5/trixie/fpm/Dockerfile similarity index 73% rename from 8.1/buster/fpm/Dockerfile rename to 8.5/trixie/fpm/Dockerfile index 3d3bba63f6..216474871e 100644 --- a/8.1/buster/fpm/Dockerfile +++ b/8.5/trixie/fpm/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,18 +58,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.1.7 -ENV PHP_URL="https://www.php.net/distributions/php-8.1.7.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.1.7.tar.xz.asc" -ENV PHP_SHA256="f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -166,9 +167,6 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ --disable-cgi \ @@ -200,15 +198,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ @@ -226,27 +225,24 @@ ENTRYPOINT ["docker-php-entrypoint"] WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -254,14 +250,22 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ echo '[www]'; \ - echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/8.1/buster/fpm/docker-php-entrypoint b/8.5/trixie/fpm/docker-php-entrypoint similarity index 100% rename from 8.1/buster/fpm/docker-php-entrypoint rename to 8.5/trixie/fpm/docker-php-entrypoint diff --git a/8.1/buster/fpm/docker-php-ext-configure b/8.5/trixie/fpm/docker-php-ext-configure similarity index 100% rename from 8.1/buster/fpm/docker-php-ext-configure rename to 8.5/trixie/fpm/docker-php-ext-configure diff --git a/8.1/buster/fpm/docker-php-ext-enable b/8.5/trixie/fpm/docker-php-ext-enable similarity index 100% rename from 8.1/buster/fpm/docker-php-ext-enable rename to 8.5/trixie/fpm/docker-php-ext-enable diff --git a/8.5/trixie/fpm/docker-php-ext-install b/8.5/trixie/fpm/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/trixie/fpm/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/buster/fpm/docker-php-source b/8.5/trixie/fpm/docker-php-source similarity index 100% rename from 8.1/buster/fpm/docker-php-source rename to 8.5/trixie/fpm/docker-php-source diff --git a/8.0-rc/buster/cli/Dockerfile b/8.5/trixie/zts/Dockerfile similarity index 78% rename from 8.0-rc/buster/cli/Dockerfile rename to 8.5/trixie/zts/Dockerfile index bebb6529de..dc0cc87a8d 100644 --- a/8.0-rc/buster/cli/Dockerfile +++ b/8.5/trixie/zts/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:trixie-slim # prevent Debian's PHP packages from being installed # https://github.com/docker-library/php/pull/542 @@ -37,7 +37,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + apt-get dist-clean ENV PHP_INI_DIR /usr/local/etc/php RUN set -eux; \ @@ -46,7 +46,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html # Apply stack smash protection to functions using local buffers and alloca() # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) @@ -58,18 +58,18 @@ ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_ ENV PHP_CPPFLAGS="$PHP_CFLAGS" ENV PHP_LDFLAGS="-Wl,-O1 -pie" -ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC 49D9AF6BC72A80D6691719C8AA23F5BE9C7097D4 D95C03BC702BE9515344AE3374E44BC9067701A5 -ENV PHP_VERSION 8.0.20RC1 -ENV PHP_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz" PHP_ASC_URL="https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc" -ENV PHP_SHA256="f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4" +ENV PHP_VERSION 8.5.5 +ENV PHP_URL="https://www.php.net/distributions/php-8.5.5.tar.xz" PHP_ASC_URL="https://www.php.net/distributions/php-8.5.5.tar.xz.asc" +ENV PHP_SHA256="95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2" RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + apt-get dist-clean; \ \ mkdir -p /usr/src; \ cd /usr/src; \ @@ -80,16 +80,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark > /dev/null; \ @@ -117,6 +115,9 @@ RUN set -eux; \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ @@ -126,8 +127,10 @@ RUN set -eux; \ if [ ! -d /usr/include/curl ]; then \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -140,8 +143,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -167,13 +168,14 @@ RUN set -eux; \ # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ --with-libdir="lib/$debMultiarch" \ \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 --enable-embed \ + \ + --enable-zts \ +# https://externals.io/message/118859 + --disable-zend-signals \ ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ @@ -198,15 +200,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get dist-clean; \ \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 pecl update-channels; \ diff --git a/8.1/buster/zts/docker-php-entrypoint b/8.5/trixie/zts/docker-php-entrypoint similarity index 100% rename from 8.1/buster/zts/docker-php-entrypoint rename to 8.5/trixie/zts/docker-php-entrypoint diff --git a/8.1/buster/zts/docker-php-ext-configure b/8.5/trixie/zts/docker-php-ext-configure similarity index 100% rename from 8.1/buster/zts/docker-php-ext-configure rename to 8.5/trixie/zts/docker-php-ext-configure diff --git a/8.1/buster/zts/docker-php-ext-enable b/8.5/trixie/zts/docker-php-ext-enable similarity index 100% rename from 8.1/buster/zts/docker-php-ext-enable rename to 8.5/trixie/zts/docker-php-ext-enable diff --git a/8.5/trixie/zts/docker-php-ext-install b/8.5/trixie/zts/docker-php-ext-install new file mode 100755 index 0000000000..fbf44849c0 --- /dev/null +++ b/8.5/trixie/zts/docker-php-ext-install @@ -0,0 +1,143 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] [--ini-name file.ini] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,ini-name:,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + + [ -e Makefile ] || docker-php-ext-configure "$ext" + + make -j"$j" + + if ! php -n -d 'display_errors=stderr' -r 'exit(ZEND_DEBUG_BUILD ? 0 : 1);' > /dev/null; then + # only "strip" modules if we aren't using a debug build of PHP + # (none of our builds are debug builds, but PHP might be recompiled with "--enable-debug" configure option) + # https://github.com/docker-library/php/issues/1268 + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec sh -euxc ' \ + strip --strip-all "$@" || : + ' -- '{}' + + fi + + make -j"$j" install + + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' '.so' ';' \ + | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} + + make -j"$j" clean + + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/8.1/buster/zts/docker-php-source b/8.5/trixie/zts/docker-php-source similarity index 100% rename from 8.1/buster/zts/docker-php-source rename to 8.5/trixie/zts/docker-php-source diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template index f6789f7437..3cb4031e40 100644 --- a/Dockerfile-linux.template +++ b/Dockerfile-linux.template @@ -12,6 +12,22 @@ ; def is_alpine: env.from | startswith("alpine") + ; + def rcVersion: + env.version | rtrimstr("-rc") + ; + def clean_apt: + # TODO once bookworm is EOL, remove this and just hard-code "apt-get dist-clean" instead + if env.from | contains("bookworm") then + "rm -rf /var/lib/apt/lists/*" + else "apt-get dist-clean" end + ; + def need_patch_18743: + # https://github.com/docker-library/php/pull/1580 + # https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c" + env.variant == "zts" # only needed for ZTS builds + and is_alpine + and IN(rcVersion; "8.2") -}} FROM {{ env.from }} @@ -48,16 +64,12 @@ ENV PHPIZE_DEPS \ RUN apk add --no-cache \ ca-certificates \ curl \ + openssl \ tar \ - xz \ -# https://github.com/docker-library/php/issues/494 - openssl + xz # ensure www-data user exists RUN set -eux; \ -{{ if env.alpineVer == "3.13" then ( -}} - addgroup -g 82 -S www-data; \ -{{ ) else "" end -}} adduser -u 82 -D -S -G www-data www-data # 82 is the standard uid/gid for "www-data" in Alpine # https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.14-stable @@ -72,7 +84,7 @@ RUN set -eux; \ curl \ xz-utils \ ; \ - rm -rf /var/lib/apt/lists/* + {{ clean_apt }} {{ ) end -}} ENV PHP_INI_DIR /usr/local/etc/php @@ -82,7 +94,7 @@ RUN set -eux; \ [ ! -d /var/www/html ]; \ mkdir -p /var/www/html; \ chown www-data:www-data /var/www/html; \ - chmod 777 /var/www/html + chmod 1777 /var/www/html {{ if env.variant == "apache" then ( -}} ENV APACHE_CONFDIR /etc/apache2 @@ -91,7 +103,7 @@ ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends apache2; \ - rm -rf /var/lib/apt/lists/*; \ + {{ clean_apt }}; \ \ # generically convert lines like # export APACHE_RUN_USER=www-data @@ -107,12 +119,14 @@ RUN set -eux; \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ "$APACHE_LOG_DIR" \ +# https://salsa.debian.org/apache-team/apache2/-/commit/b97ca8714890ead1ba6c095699dde752e8433205 + "$APACHE_RUN_DIR/socks" \ ; do \ rm -rvf "$dir"; \ mkdir -p "$dir"; \ chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ # allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) - chmod 777 "$dir"; \ + chmod 1777 "$dir"; \ done; \ \ # delete the "index.html" that installing Apache drops in here @@ -159,36 +173,38 @@ ENV GPG_KEYS {{ # https://www.php.net/gpg-keys.php # https://www.php.net/downloads.php - "8.2": [ - # https://wiki.php.net/todo/php82#release_managers - # https://www.php.net/gpg-keys.php#gpg-8.2 - "39B6 4134 3D8C 104B 2B14 6DC3 F9C3 9DC0 B969 8544", # ramsey - "E609 13E4 DF20 9907 D8E3 0D96 659A 97C9 CF2A 795A", # sergey - "1198 C011 7593 497A 5EC5 C199 286A F1F9 8974 69DC" # pierrick + "8.5": [ + # https://wiki.php.net/todo/php85#release_managers + # https://www.php.net/gpg-keys.php#gpg-8.5 + "1198 C011 7593 497A 5EC5 C199 286A F1F9 8974 69DC", # pierrick + "49D9 AF6B C72A 80D6 6917 19C8 AA23 F5BE 9C70 97D4", # edorian + "D95C 03BC 702B E951 5344 AE33 74E4 4BC9 0677 01A5" # daniels ], - "8.1": [ - # https://wiki.php.net/todo/php81#release_managers - # https://www.php.net/gpg-keys.php#gpg-8.1 - "5289 95BF EDFB A719 1D46 839E F9BA 0ADA 31CB D89E", # krakjoe - "39B6 4134 3D8C 104B 2B14 6DC3 F9C3 9DC0 B969 8544", # ramsey - "F1F6 9223 8FBC 1666 E5A5 CCD4 199F 9DFE F6FF BAFD" # patrickallaert + "8.4": [ + # https://wiki.php.net/todo/php84#release_managers + # https://www.php.net/gpg-keys.php#gpg-8.4 + "AFD8 691F DAED F03B DF6E 4605 63F1 5A9B 7153 76CA", # ericmann + "9D7F 99A0 CB8F 05C8 A695 8D62 56A9 7AF7 600A 39A6", # calvinb + "0616 E93D 95AF 4712 43E2 6761 7704 26E1 7EBB B3DD" # saki ], - "8.0": [ - # https://wiki.php.net/todo/php80#release_managers - # https://www.php.net/gpg-keys.php#gpg-8.0 - "1729 F839 38DA 44E2 7BA0 F4D3 DBDB 3974 70D1 2172", # pollita - "BFDD D286 4282 4F81 18EF 7790 9B67 A5C1 2229 118F" # carusogabriel + "8.3": [ + # https://wiki.php.net/todo/php83#release_managers + # https://www.php.net/gpg-keys.php#gpg-8.3 + "1198 C011 7593 497A 5EC5 C199 286A F1F9 8974 69DC", # pierrick + "C28D937575603EB4ABB725861C0779DC5C0A9DE4", # bukka + "AFD8 691F DAED F03B DF6E 4605 63F1 5A9B 7153 76CA" # ericmann ], - "7.4": [ - # https://wiki.php.net/todo/php74#release_managers - # https://www.php.net/gpg-keys.php#gpg-7.4 - "4267 0A7F E4D0 441C 8E46 3234 9E4F DC07 4A4E F02D", # petk - "5A52 8807 81F7 5560 8BF8 15FC 910D EB46 F53E A312" # derick + "8.2": [ + # https://wiki.php.net/todo/php82#release_managers + # https://www.php.net/gpg-keys.php#gpg-8.2 + "39B6 4134 3D8C 104B 2B14 6DC3 F9C3 9DC0 B969 8544", # ramsey + "E609 13E4 DF20 9907 D8E3 0D96 659A 97C9 CF2A 795A", # sergey + "1198 C011 7593 497A 5EC5 C199 286A F1F9 8974 69DC" # pierrick ], - }[env.version | rtrimstr("-rc")] // error("missing GPG keys for " + env.version) + }[rcVersion] // error("missing GPG keys for " + rcVersion) | map(gsub(" "; "")) | join(" ") }} @@ -204,8 +220,8 @@ RUN set -eux; \ {{ ) else ( -}} savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ - apt-get install -y --no-install-recommends gnupg dirmngr; \ - rm -rf /var/lib/apt/lists/*; \ + apt-get install -y --no-install-recommends gnupg; \ + {{ clean_apt }}; \ {{ ) end -}} \ mkdir -p /usr/src; \ @@ -217,16 +233,14 @@ RUN set -eux; \ echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ fi; \ \ - if [ -n "$PHP_ASC_URL" ]; then \ - curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ - export GNUPGHOME="$(mktemp -d)"; \ - for key in $GPG_KEYS; do \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - done; \ - gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - fi; \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ \ {{ if is_alpine then ( -}} apk del --no-network .fetch-deps @@ -259,12 +273,14 @@ RUN set -eux; \ "libsodium-dev", "libxml2-dev", "openssl-dev", + # https://github.com/docker-library/php/pull/1580 (18743) + if need_patch_18743 then "patch", "patchutils" else empty end, "readline-dev", "sqlite-dev", # https://github.com/docker-library/php/issues/888 - if (.version | version_id) >= ("7.4" | version_id) then "linux-headers" else empty end, + "linux-headers", # oniguruma is part of mbstring in php 7.4+ - if (.version | version_id) >= ("7.4" | version_id) then "oniguruma-dev" else empty end + "oniguruma-dev" else # debian packages if env.variant == "apache" then "apache2-dev" else empty end, @@ -277,7 +293,7 @@ RUN set -eux; \ "libxml2-dev", "zlib1g-dev", # oniguruma is part of mbstring in php 7.4+ - if (.version | version_id) >= ("7.4" | version_id) then "libonig-dev" else empty end + "libonig-dev" end ] | sort[] | ( -}} {{ . }} \ @@ -290,19 +306,26 @@ RUN set -eux; \ {{ if is_alpine then ( -}} # make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) rm -vf /usr/include/iconv.h; \ -{{ if (.version | version_id) < ("8" | version_id) then ( -}} -# PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df - ln -sv /usr/include/gnu-libiconv/*.h /usr/include/; \ -{{ ) else "" end -}} \ {{ ) else "" end -}} export \ CFLAGS="$PHP_CFLAGS" \ CPPFLAGS="$PHP_CPPFLAGS" \ LDFLAGS="$PHP_LDFLAGS" \ +# https://github.com/php/php-src/blob/d6299206dd828382753453befd1b915491b741c6/configure.ac#L1496-L1511 + PHP_BUILD_PROVIDER='https://github.com/docker-library/php' \ + PHP_UNAME='Linux - Docker' \ ; \ docker-php-source extract; \ cd /usr/src/php; \ +{{ if need_patch_18743 then ( -}} + # https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c" + # https://github.com/docker-library/php/pull/1580 + curl -fL 'https://github.com/php/php-src/commit/b3c8afe272a6919248986c703c2e1defc73ff707.patch?full_index=1' -o 18743.patch; \ + echo 'b334f73434c9732a4b27a42eb5d417e10df842e854c02a3e753b2479f8978bf5 *18743.patch' | sha256sum -c -; \ + filterdiff -x '*/NEWS' 18743.patch | patch -p1; \ + rm 18743.patch; \ +{{ ) else "" end -}} gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ {{ if is_alpine then "" else ( -}} debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ @@ -311,8 +334,10 @@ RUN set -eux; \ ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ fi; \ {{ ) end -}} + test "$PHP_INI_DIR" != "${PHP_INI_DIR%/php}"; \ ./configure \ --build="$gnuArch" \ + --sysconfdir="${PHP_INI_DIR%/php}" \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ \ @@ -325,8 +350,6 @@ RUN set -eux; \ # https://github.com/docker-library/php/issues/822 --with-pic \ \ -# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) - --enable-ftp \ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) --enable-mbstring \ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) @@ -345,7 +368,7 @@ RUN set -eux; \ --with-readline \ --with-zlib \ \ -{{ if env.variant == "cli" then ( -}} +{{ if env.variant | IN("cli", "zts") then ( -}} # https://github.com/docker-library/php/pull/1259 --enable-phpdbg \ --enable-phpdbg-readline \ @@ -354,25 +377,29 @@ RUN set -eux; \ --disable-phpdbg \ {{ ) end -}} \ -{{ if (.version | version_id) >= ("7.4" | version_id) then ( -}} # in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") --with-pear \ \ -{{ ) else "" end -}} -# bundled pcre does not support JIT on s390x -# https://manpages.debian.org/bullseye/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT +{{ if rcVersion | IN("8.2") then ( -}} +# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+) +# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c +# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib {{ if is_alpine then ( -}} - $(test "$gnuArch" = 's390x-linux-musl' && echo '--without-pcre-jit') \ + $(test "$gnuArch" = 'riscv64-linux-musl' && echo '--without-pcre-jit') \ {{ ) else ( -}} - $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + $(test "$gnuArch" = 'riscv64-linux-gnu' && echo '--without-pcre-jit') \ +{{ ) end -}} +{{ ) else "" end -}} +{{ if is_alpine then "" else ( -}} --with-libdir="lib/$debMultiarch" \ {{ ) end -}} {{ # https://github.com/docker-library/php/issues/280 -}} -{{ if env.variant == "cli" then "" else ( -}} +{{ if env.variant | IN("cli", "zts") then "" else ( -}} \ --disable-cgi \ {{ ) end -}} -{{ if (env.variant == "cli" or env.variant == "zts") and (is_alpine | not) then ( -}} +{{ # zts + alpine special cased for embed (otherwise zts is effectively cli): https://github.com/docker-library/php/pull/1342 -}} +{{ if (env.variant == "zts") or (env.variant == "cli" and (is_alpine | not)) then ( -}} \ # https://github.com/docker-library/php/pull/939#issuecomment-730501748 --enable-embed \ @@ -387,16 +414,24 @@ RUN set -eux; \ --with-fpm-group=www-data \ {{ ) elif env.variant == "zts" then ( -}} \ -{{ if (.version | version_id) >= ("8" | version_id) then ( -}} --enable-zts \ -{{ ) else ( -}} - --enable-maintainer-zts \ -{{ ) end -}} +# https://externals.io/message/118859 + --disable-zend-signals \ +{{ if rcVersion | IN("8.2") then ( -}} + --enable-zend-max-execution-timers \ +{{ ) else "" end -}} +{{ ) else "" end -}} +{{ if env.DOCKER_PHP_ENABLE_DEBUG then ( -}} +{{ # DOCKER_PHP_ENABLE_DEBUG is not used or supported by official-images; this is for users who want to build their own php image with debug enabled -}} +{{ # example usage to regenerate Dockerfiles with debug enabled: "DOCKER_PHP_ENABLE_DEBUG=1 ./apply-templates" -}} + --enable-debug \ {{ ) else "" end -}} ; \ make -j "$(nproc)"; \ find -type f -name '*.a' -delete; \ make install; \ +{{ if env.DOCKER_PHP_ENABLE_DEBUG then "" else ( -}} +{{ # DOCKER_PHP_ENABLE_DEBUG is not used by official-images -}} find \ /usr/local \ -type f \ @@ -405,6 +440,7 @@ RUN set -eux; \ strip --strip-all "$@" || : \ ' -- '{}' + \ ; \ +{{ ) end -}} make clean; \ \ # https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) @@ -428,15 +464,16 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ + | xargs -rt dpkg-query --search \ +# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) + | awk 'sub(":$", "", $1) { print $1 }' \ | sort -u \ | xargs -r apt-mark manual \ ; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + {{ clean_apt }}; \ {{ ) end -}} \ # update pecl channel definitions https://github.com/docker-library/php/issues/443 @@ -448,20 +485,14 @@ RUN set -eux; \ COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +{{ if IN(rcVersion; "8.2", "8.3", "8.4") then ( -}} +# enable OPcache by default (https://wiki.php.net/rfc/make_opcache_required) +RUN docker-php-ext-enable opcache + +{{ ) else "" end -}} # sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) RUN docker-php-ext-enable sodium -{{ - # https://github.com/docker-library/php/issues/865 - # https://bugs.php.net/bug.php?id=76324 - # https://github.com/php/php-src/pull/3632 - # https://github.com/php/php-src/commit/2d03197749696ac3f8effba6b7977b0d8729fef3 - if (is_alpine | not) and (.version | version_id) < ("7.4" | version_id) then ( --}} -# temporary "freetype-config" workaround for https://github.com/docker-library/php/issues/865 (https://bugs.php.net/bug.php?id=76324) -RUN { echo '#!/bin/sh'; echo 'exec pkg-config "$@" freetype2'; } > /usr/local/bin/freetype-config && chmod +x /usr/local/bin/freetype-config - -{{ ) else "" end -}} ENTRYPOINT ["docker-php-entrypoint"] {{ if env.variant == "apache" then ( -}} # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop @@ -475,27 +506,26 @@ EXPOSE 80 WORKDIR /var/www/html RUN set -eux; \ - cd /usr/local/etc; \ - if [ -d php-fpm.d ]; then \ - # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" - sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ - cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ - else \ - # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency - mkdir php-fpm.d; \ - cp php-fpm.conf.default php-fpm.d/www.conf; \ - { \ - echo '[global]'; \ - echo 'include=etc/php-fpm.d/*.conf'; \ - } | tee php-fpm.conf; \ - fi; \ + cd "${PHP_INI_DIR%/php}"; \ + \ + cp -v php-fpm.conf.default php-fpm.conf; \ + cp -v php-fpm.d/www.conf.default php-fpm.d/www.conf; \ +{{ if .version | IN("8.2.30", "8.3.29", "8.4.16", "8.5.1") then "" else ( -}} + \ + # comment out localhost-only listen address + grep -E '^listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ + sed -ri 's/^(listen = 127.0.0.1:9000)/;\1/' php-fpm.d/www.conf; \ + grep -E '^;listen = 127.0.0.1:9000' php-fpm.d/www.conf; \ +{{ ) end -}} + \ { \ echo '[global]'; \ echo 'error_log = /proc/self/fd/2'; \ echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ echo; \ echo '[www]'; \ - echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo '; php-fpm closes STDOUT on startup, so sending logs to /proc/self/fd/1 does not work.'; \ + echo '; https://bugs.php.net/bug.php?id=73886'; \ echo 'access.log = /proc/self/fd/2'; \ echo; \ echo 'clear_env = no'; \ @@ -503,14 +533,30 @@ RUN set -eux; \ echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ echo 'catch_workers_output = yes'; \ echo 'decorate_workers_output = no'; \ +{{ if .version | IN("8.2.30", "8.3.29", "8.4.16", "8.5.1") then "" else ( -}} + echo; \ + echo '; default listen address for easy override in later php-fpm.d/*.conf files'; \ + echo 'listen = 9000'; \ +{{ ) end -}} } | tee php-fpm.d/docker.conf; \ { \ echo '[global]'; \ echo 'daemonize = no'; \ +{{ if .version | IN("8.2.30", "8.3.29", "8.4.16", "8.5.1") then ( -}} echo; \ echo '[www]'; \ echo 'listen = 9000'; \ - } | tee php-fpm.d/zz-docker.conf +{{ ) elif rcVersion | IN("8.2", "8.3", "8.4", "8.5") then ( -}} + echo; \ + echo '; the [www] ini section below is for backwards compatibility and will be removed in 8.6+'; \ + echo '[www]'; \ +{{ ) else "" end -}} + } | tee php-fpm.d/zz-docker.conf; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ + { \ + echo '; https://github.com/docker-library/php/issues/878#issuecomment-938595965'; \ + echo 'fastcgi.logging = Off'; \ + } > "$PHP_INI_DIR/conf.d/docker-fpm.ini" # Override stop signal to stop process gracefully # https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 diff --git a/README.md b/README.md index d2c57c868c..4a233dcd93 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,4 @@ For more information about the full official images change lifecycle, see [the " For outstanding `php` image PRs, check [PRs with the "library/php" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Fphp). For the current "source of truth" for [`php`](https://hub.docker.com/_/php/), see [the `library/php` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/php). ---- - -- [![build status badge](https://img.shields.io/github/workflow/status/docker-library/php/GitHub%20CI/master?label=GitHub%20CI)](https://github.com/docker-library/php/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) -- [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/php.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/php/) - -| Build | Status | Badges | (per-arch) | -|:-:|:-:|:-:|:-:| -| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/php.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/php/) | [![arm32v5 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/php.svg?label=arm32v5)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/php/) | [![arm32v6 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/php.svg?label=arm32v6)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/php/) | [![arm32v7 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/php.svg?label=arm32v7)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/php/) | -| [![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/php.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/php/) | [![i386 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/i386/job/php.svg?label=i386)](https://doi-janky.infosiftr.net/job/multiarch/job/i386/job/php/) | [![mips64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/php.svg?label=mips64le)](https://doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/php/) | [![ppc64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/php.svg?label=ppc64le)](https://doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/php/) | -| [![s390x build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/s390x/job/php.svg?label=s390x)](https://doi-janky.infosiftr.net/job/multiarch/job/s390x/job/php/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/php.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/php/) | - diff --git a/apply-templates.sh b/apply-templates.sh index 34aa5e0424..a644fe5a62 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -8,7 +8,7 @@ if [ -n "${BASHBREW_SCRIPTS:-}" ]; then jqt="$BASHBREW_SCRIPTS/jq-template.awk" elif [ "$BASH_SOURCE" -nt "$jqt" ]; then # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk - wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/1da7341a79651d28fbcc3d14b9176593c4231942/scripts/jq-template.awk' + wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk' fi if [ "$#" -eq 0 ]; then diff --git a/docker-php-ext-install b/docker-php-ext-install index aa0b96c5a3..fbf44849c0 100755 --- a/docker-php-ext-install +++ b/docker-php-ext-install @@ -126,7 +126,7 @@ for ext in $exts; do find modules \ -maxdepth 1 \ -name '*.so' \ - -exec basename '{}' ';' \ + -exec basename '{}' '.so' ';' \ | xargs -r docker-php-ext-enable ${iniName:+--ini-name "$iniName"} make -j"$j" clean diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 5d863ebf8b..74b08d27c4 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,8 +2,7 @@ set -Eeuo pipefail declare -A aliases=( - [7.4]='7' - [8.1]='8 latest' + [8.5]='8 latest' ) self="$(basename "$BASH_SOURCE")" @@ -41,17 +40,19 @@ dirCommit() { getArches() { local repo="$1"; shift - local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/' + local officialImagesBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/" - eval "declare -g -A parentRepoToArches=( $( - find -name 'Dockerfile' -exec awk ' + local parentRepoToArchesStr + parentRepoToArchesStr="$( + find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" ' toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { - print "'"$officialImagesUrl"'" $2 + printf "%s%s\n", officialImagesBase, $2 } ' '{}' + \ | sort -u \ - | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' - ) )" + | xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"' + )" + eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )" } getArches 'php' diff --git a/versions.json b/versions.json index abb88dc80a..120e6832c8 100644 --- a/versions.json +++ b/versions.json @@ -1,114 +1,94 @@ { - "7.4": { - "ascUrl": "https://www.php.net/distributions/php-7.4.30.tar.xz.asc", - "sha256": "ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d", - "url": "https://www.php.net/distributions/php-7.4.30.tar.xz", + "8.2": { + "version": "8.2.30", + "url": "https://www.php.net/distributions/php-8.2.30.tar.xz", + "ascUrl": "https://www.php.net/distributions/php-8.2.30.tar.xz.asc", + "sha256": "bc90523e17af4db46157e75d0c9ef0b9d0030b0514e62c26ba7b513b8c4eb015", "variants": [ - "bullseye/cli", - "bullseye/apache", - "bullseye/fpm", - "bullseye/zts", - "buster/cli", - "buster/apache", - "buster/fpm", - "buster/zts", - "alpine3.16/cli", - "alpine3.16/fpm", - "alpine3.16/zts", - "alpine3.15/cli", - "alpine3.15/fpm", - "alpine3.15/zts" - ], - "version": "7.4.30" + "trixie/cli", + "trixie/apache", + "trixie/fpm", + "trixie/zts", + "bookworm/cli", + "bookworm/apache", + "bookworm/fpm", + "bookworm/zts", + "alpine3.23/cli", + "alpine3.23/fpm", + "alpine3.23/zts", + "alpine3.22/cli", + "alpine3.22/fpm", + "alpine3.22/zts" + ] }, - "7.4-rc": null, - "8.0": { - "ascUrl": "https://www.php.net/distributions/php-8.0.20.tar.xz.asc", - "sha256": "973fec765336ee01f47536a5db1c2eee98df9d34a41522b7b6c760159bf0a77b", - "url": "https://www.php.net/distributions/php-8.0.20.tar.xz", + "8.2-rc": null, + "8.3": { + "version": "8.3.30", + "url": "https://www.php.net/distributions/php-8.3.30.tar.xz", + "ascUrl": "https://www.php.net/distributions/php-8.3.30.tar.xz.asc", + "sha256": "67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48", "variants": [ - "bullseye/cli", - "bullseye/apache", - "bullseye/fpm", - "bullseye/zts", - "buster/cli", - "buster/apache", - "buster/fpm", - "buster/zts", - "alpine3.16/cli", - "alpine3.16/fpm", - "alpine3.16/zts", - "alpine3.15/cli", - "alpine3.15/fpm", - "alpine3.15/zts" - ], - "version": "8.0.20" + "trixie/cli", + "trixie/apache", + "trixie/fpm", + "trixie/zts", + "bookworm/cli", + "bookworm/apache", + "bookworm/fpm", + "bookworm/zts", + "alpine3.23/cli", + "alpine3.23/fpm", + "alpine3.23/zts", + "alpine3.22/cli", + "alpine3.22/fpm", + "alpine3.22/zts" + ] }, - "8.0-rc": { - "ascUrl": "https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz.asc", - "sha256": "f6cdb3f90838d0a0215f92e3ce41c00934f36e9c6a3ab05491168ba5c5b6c8b4", - "url": "https://downloads.php.net/~pollita/php-8.0.20RC1.tar.xz", + "8.3-rc": null, + "8.4": { + "version": "8.4.20", + "url": "https://www.php.net/distributions/php-8.4.20.tar.xz", + "ascUrl": "https://www.php.net/distributions/php-8.4.20.tar.xz.asc", + "sha256": "e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7", "variants": [ - "bullseye/cli", - "bullseye/apache", - "bullseye/fpm", - "bullseye/zts", - "buster/cli", - "buster/apache", - "buster/fpm", - "buster/zts", - "alpine3.16/cli", - "alpine3.16/fpm", - "alpine3.16/zts", - "alpine3.15/cli", - "alpine3.15/fpm", - "alpine3.15/zts" - ], - "version": "8.0.20RC1" + "trixie/cli", + "trixie/apache", + "trixie/fpm", + "trixie/zts", + "bookworm/cli", + "bookworm/apache", + "bookworm/fpm", + "bookworm/zts", + "alpine3.23/cli", + "alpine3.23/fpm", + "alpine3.23/zts", + "alpine3.22/cli", + "alpine3.22/fpm", + "alpine3.22/zts" + ] }, - "8.1": { - "ascUrl": "https://www.php.net/distributions/php-8.1.7.tar.xz.asc", - "sha256": "f042322f1b5a9f7c2decb84b7086ef676896c2f7178739b9672afafa964ed0e5", - "url": "https://www.php.net/distributions/php-8.1.7.tar.xz", + "8.4-rc": null, + "8.5": { + "version": "8.5.5", + "url": "https://www.php.net/distributions/php-8.5.5.tar.xz", + "ascUrl": "https://www.php.net/distributions/php-8.5.5.tar.xz.asc", + "sha256": "95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2", "variants": [ - "bullseye/cli", - "bullseye/apache", - "bullseye/fpm", - "bullseye/zts", - "buster/cli", - "buster/apache", - "buster/fpm", - "buster/zts", - "alpine3.16/cli", - "alpine3.16/fpm", - "alpine3.16/zts", - "alpine3.15/cli", - "alpine3.15/fpm", - "alpine3.15/zts" - ], - "version": "8.1.7" + "trixie/cli", + "trixie/apache", + "trixie/fpm", + "trixie/zts", + "bookworm/cli", + "bookworm/apache", + "bookworm/fpm", + "bookworm/zts", + "alpine3.23/cli", + "alpine3.23/fpm", + "alpine3.23/zts", + "alpine3.22/cli", + "alpine3.22/fpm", + "alpine3.22/zts" + ] }, - "8.1-rc": null, - "8.2-rc": { - "ascUrl": "https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz.asc", - "sha256": "08917e5986424c664d1bdf9fefdbcee39724e959e848c77247bdc268499ec58a", - "url": "https://downloads.php.net/~sergey/php-8.2.0alpha1.tar.xz", - "variants": [ - "bullseye/cli", - "bullseye/apache", - "bullseye/fpm", - "bullseye/zts", - "buster/cli", - "buster/apache", - "buster/fpm", - "buster/zts", - "alpine3.16/cli", - "alpine3.16/fpm", - "alpine3.16/zts", - "alpine3.15/cli", - "alpine3.15/fpm", - "alpine3.15/zts" - ], - "version": "8.2.0alpha1" - } + "8.5-rc": null } diff --git a/versions.sh b/versions.sh index d22a7fcc8e..62d4c49775 100755 --- a/versions.sh +++ b/versions.sh @@ -3,6 +3,8 @@ set -Eeuo pipefail cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +# TODO consume https://www.php.net/releases/branches.php and https://www.php.net/release-candidates.php?format=json here like in Go, Julia, etc (so we can have a canonical "here's all the versions possible" mode, and more automated metadata like EOL 👀) + versions=( "$@" ) if [ ${#versions[@]} -eq 0 ]; then versions=( */ ) @@ -31,7 +33,7 @@ for version in "${versions[@]}"; do ) ] ' else - apiUrl='https://qa.php.net/api.php?type=qa-releases&format=json' + apiUrl='https://www.php.net/release-candidates.php?format=json' apiJqExpr=' (.releases // [])[] | select(.version | startswith(env.rcVersion)) @@ -52,16 +54,9 @@ for version in "${versions[@]}"; do unset IFS if [ "${#possibles[@]}" -eq 0 ]; then - if [ "$rcVersion" = "$version" ]; then - echo >&2 - echo >&2 "error: unable to determine available releases of $version" - echo >&2 - exit 1 - else - echo >&2 "warning: skipping/removing '$version' (does not appear to exist upstream)" - json="$(jq <<<"$json" -c '.[env.version] = null')" - continue - fi + echo >&2 "warning: skipping/removing '$version' (does not appear to exist upstream)" + json="$(jq <<<"$json" -c '.[env.version] = null')" + continue fi # format of "possibles" array entries is "VERSION URL.TAR.XZ URL.TAR.XZ.ASC SHA256" (each value shell quoted) @@ -72,55 +67,59 @@ for version in "${versions[@]}"; do ascUrl="${possi[2]}" sha256="${possi[3]}" - if ! wget -q --spider "$url"; then + if ! curl --head -fsSL "$url" -o /dev/null; then echo >&2 "error: '$url' appears to be missing" exit 1 fi - # if we don't have a .asc URL, let's see if we can figure one out :) - if [ -z "$ascUrl" ] && wget -q --spider "$url.asc"; then + # if we don't have a .asc URL, let's just assume one :) + if [ -z "$ascUrl" ]; then ascUrl="$url.asc" fi - variants='[]' - # order here controls the order of the library/ file - for suite in \ - bullseye \ - buster \ - alpine3.16 \ - alpine3.15 \ - ; do - for variant in cli apache fpm zts; do - if [[ "$suite" = alpine* ]]; then - if [ "$variant" = 'apache' ]; then - continue - fi - fi - export suite variant - variants="$(jq <<<"$variants" -c '. + [ env.suite + "/" + env.variant ]')" - done - done - echo "$version: $fullVersion" export fullVersion url ascUrl sha256 json="$( - jq <<<"$json" -c --argjson variants "$variants" ' + jq <<<"$json" -c ' .[env.version] = { version: env.fullVersion, url: env.url, ascUrl: env.ascUrl, sha256: env.sha256, - variants: $variants, + variants: [ + # order here controls the order of the library/ file + ( + "trixie", + "bookworm", + "alpine3.23", + "alpine3.22", + empty + ) as $suite + | ( + "cli", + "apache", + "fpm", + "zts", + empty + ) as $variant + | if $suite | startswith("alpine") and $variant == "apache" then empty else + "\($suite)/\($variant)" + end + ], } ' )" - if [ "$version" = "$rcVersion" ]; then - json="$(jq <<<"$json" -c ' - .[env.version + "-rc"] //= null - ')" - fi + # make sure RCs and releases have corresponding pairs + json="$(jq <<<"$json" -c ' + .[ + env.version + + if env.version == env.rcVersion then + "-rc" + else "" end + ] //= null + ')" done -jq <<<"$json" -S . > versions.json +jq <<<"$json" 'to_entries | sort_by(.key) | from_entries' > versions.json