From b6d94a4ceec99a3a3e3ac767622317397f036f14 Mon Sep 17 00:00:00 2001 From: Guillaume Sainthillier Date: Mon, 12 Oct 2026 15:07:00 +0200 Subject: [PATCH] perf(php): stop OPcache timestamp checks and size it for Symfony apps opcache.validate_timestamps is now driven by PHP_OPCACHE_VALIDATE_TIMESTAMPS, 0 by default in the Apache and FrankenPHP images: with revalidate_freq = 0, PHP was stat()ing every included file on every request. Set it to 1 when the sources are mounted and edited in place. The cache is also sized for a Symfony app and its vendors: max_accelerated_files 10000 -> 20000, interned_strings_buffer 8 -> 16 MB, memory_consumption 128 -> 256 MB. On a symfony/skeleton app in prod (2,300 PHP files, ab -c 8 inside the container, 2 CPUs), 8.5-symfony goes from ~3,000 to ~4,800 requests/s. --- 5.6/conf/php.ini | 7 ++++++- 7.1-symfony/conf/php.ini | 7 ++++++- 7.1/conf/php.ini | 7 ++++++- 7.2-symfony/conf/php.ini | 7 ++++++- 7.2/conf/php.ini | 7 ++++++- 7.3-symfony/conf/php.ini | 7 ++++++- 7.3/conf/php.ini | 7 ++++++- 7.4-symfony/conf/php.ini | 7 ++++++- 7.4/conf/php.ini | 7 ++++++- 8.0-symfony/conf/php.ini | 7 ++++++- 8.0/conf/php.ini | 7 ++++++- 8.1-symfony/Dockerfile | 1 + 8.1-symfony/conf/php.ini | 7 ++++++- 8.1/Dockerfile | 1 + 8.1/conf/php.ini | 7 ++++++- 8.2-frankenphp-alpine/Dockerfile | 1 + 8.2-frankenphp-alpine/conf/php.ini | 7 ++++++- 8.2-frankenphp-bookworm/Dockerfile | 1 + 8.2-frankenphp-bookworm/conf/php.ini | 7 ++++++- 8.2-symfony/Dockerfile | 1 + 8.2-symfony/conf/php.ini | 7 ++++++- 8.2/Dockerfile | 1 + 8.2/conf/php.ini | 7 ++++++- 8.3-frankenphp-alpine/Dockerfile | 1 + 8.3-frankenphp-alpine/conf/php.ini | 7 ++++++- 8.3-frankenphp-bookworm/Dockerfile | 1 + 8.3-frankenphp-bookworm/conf/php.ini | 7 ++++++- 8.3-symfony/Dockerfile | 1 + 8.3-symfony/conf/php.ini | 7 ++++++- 8.3/Dockerfile | 1 + 8.3/conf/php.ini | 7 ++++++- 8.4-frankenphp-alpine/Dockerfile | 1 + 8.4-frankenphp-alpine/conf/php.ini | 7 ++++++- 8.4-frankenphp-bookworm/Dockerfile | 1 + 8.4-frankenphp-bookworm/conf/php.ini | 7 ++++++- 8.4-symfony/Dockerfile | 1 + 8.4-symfony/conf/php.ini | 7 ++++++- 8.4/Dockerfile | 1 + 8.4/conf/php.ini | 7 ++++++- 8.5-frankenphp-alpine/Dockerfile | 1 + 8.5-frankenphp-alpine/conf/php.ini | 7 ++++++- 8.5-frankenphp-bookworm/Dockerfile | 1 + 8.5-frankenphp-bookworm/conf/php.ini | 7 ++++++- 8.5-symfony/Dockerfile | 1 + 8.5-symfony/conf/php.ini | 7 ++++++- 8.5/Dockerfile | 1 + 8.5/conf/php.ini | 7 ++++++- README.md | 8 ++++++++ _shared/conf/php.ini | 7 ++++++- 49 files changed, 206 insertions(+), 30 deletions(-) diff --git a/5.6/conf/php.ini b/5.6/conf/php.ini index 75371d2..024f358 100644 --- a/5.6/conf/php.ini +++ b/5.6/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.1-symfony/conf/php.ini b/7.1-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/7.1-symfony/conf/php.ini +++ b/7.1-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.1/conf/php.ini b/7.1/conf/php.ini index 75371d2..024f358 100644 --- a/7.1/conf/php.ini +++ b/7.1/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.2-symfony/conf/php.ini b/7.2-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/7.2-symfony/conf/php.ini +++ b/7.2-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.2/conf/php.ini b/7.2/conf/php.ini index 75371d2..024f358 100644 --- a/7.2/conf/php.ini +++ b/7.2/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.3-symfony/conf/php.ini b/7.3-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/7.3-symfony/conf/php.ini +++ b/7.3-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.3/conf/php.ini b/7.3/conf/php.ini index 75371d2..024f358 100644 --- a/7.3/conf/php.ini +++ b/7.3/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.4-symfony/conf/php.ini b/7.4-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/7.4-symfony/conf/php.ini +++ b/7.4-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/7.4/conf/php.ini b/7.4/conf/php.ini index 75371d2..024f358 100644 --- a/7.4/conf/php.ini +++ b/7.4/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.0-symfony/conf/php.ini b/8.0-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/8.0-symfony/conf/php.ini +++ b/8.0-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.0/conf/php.ini b/8.0/conf/php.ini index 75371d2..024f358 100644 --- a/8.0/conf/php.ini +++ b/8.0/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.1-symfony/Dockerfile b/8.1-symfony/Dockerfile index 566bf14..d96bae6 100644 --- a/8.1-symfony/Dockerfile +++ b/8.1-symfony/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.1-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.1-symfony/conf/php.ini b/8.1-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/8.1-symfony/conf/php.ini +++ b/8.1-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 8aeee48..dd36f72 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.1-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.1/conf/php.ini b/8.1/conf/php.ini index 75371d2..024f358 100644 --- a/8.1/conf/php.ini +++ b/8.1/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.2-frankenphp-alpine/Dockerfile b/8.2-frankenphp-alpine/Dockerfile index 0d66d7d..82dd4dd 100644 --- a/8.2-frankenphp-alpine/Dockerfile +++ b/8.2-frankenphp-alpine/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/ash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.2-frankenphp-alpine/conf/php.ini b/8.2-frankenphp-alpine/conf/php.ini index 75371d2..024f358 100644 --- a/8.2-frankenphp-alpine/conf/php.ini +++ b/8.2-frankenphp-alpine/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.2-frankenphp-bookworm/Dockerfile b/8.2-frankenphp-bookworm/Dockerfile index 61d59e6..79e333b 100644 --- a/8.2-frankenphp-bookworm/Dockerfile +++ b/8.2-frankenphp-bookworm/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.2-frankenphp-bookworm/conf/php.ini b/8.2-frankenphp-bookworm/conf/php.ini index 75371d2..024f358 100644 --- a/8.2-frankenphp-bookworm/conf/php.ini +++ b/8.2-frankenphp-bookworm/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.2-symfony/Dockerfile b/8.2-symfony/Dockerfile index 91a8777..711b389 100644 --- a/8.2-symfony/Dockerfile +++ b/8.2-symfony/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.2-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.2-symfony/conf/php.ini b/8.2-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/8.2-symfony/conf/php.ini +++ b/8.2-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 92c2d62..79f6b06 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.2-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.2/conf/php.ini b/8.2/conf/php.ini index 75371d2..024f358 100644 --- a/8.2/conf/php.ini +++ b/8.2/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.3-frankenphp-alpine/Dockerfile b/8.3-frankenphp-alpine/Dockerfile index 6aa3101..17b9150 100644 --- a/8.3-frankenphp-alpine/Dockerfile +++ b/8.3-frankenphp-alpine/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/ash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.3-frankenphp-alpine/conf/php.ini b/8.3-frankenphp-alpine/conf/php.ini index 75371d2..024f358 100644 --- a/8.3-frankenphp-alpine/conf/php.ini +++ b/8.3-frankenphp-alpine/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.3-frankenphp-bookworm/Dockerfile b/8.3-frankenphp-bookworm/Dockerfile index 548112b..f586d8e 100644 --- a/8.3-frankenphp-bookworm/Dockerfile +++ b/8.3-frankenphp-bookworm/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.3-frankenphp-bookworm/conf/php.ini b/8.3-frankenphp-bookworm/conf/php.ini index 75371d2..024f358 100644 --- a/8.3-frankenphp-bookworm/conf/php.ini +++ b/8.3-frankenphp-bookworm/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.3-symfony/Dockerfile b/8.3-symfony/Dockerfile index 2833d4f..1a70538 100644 --- a/8.3-symfony/Dockerfile +++ b/8.3-symfony/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.3-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.3-symfony/conf/php.ini b/8.3-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/8.3-symfony/conf/php.ini +++ b/8.3-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 09c734b..6ff10db 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.3-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.3/conf/php.ini b/8.3/conf/php.ini index 75371d2..024f358 100644 --- a/8.3/conf/php.ini +++ b/8.3/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.4-frankenphp-alpine/Dockerfile b/8.4-frankenphp-alpine/Dockerfile index 272101d..0bc7949 100644 --- a/8.4-frankenphp-alpine/Dockerfile +++ b/8.4-frankenphp-alpine/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/ash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.4-frankenphp-alpine/conf/php.ini b/8.4-frankenphp-alpine/conf/php.ini index 75371d2..024f358 100644 --- a/8.4-frankenphp-alpine/conf/php.ini +++ b/8.4-frankenphp-alpine/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.4-frankenphp-bookworm/Dockerfile b/8.4-frankenphp-bookworm/Dockerfile index 584ccd7..30eae62 100644 --- a/8.4-frankenphp-bookworm/Dockerfile +++ b/8.4-frankenphp-bookworm/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.4-frankenphp-bookworm/conf/php.ini b/8.4-frankenphp-bookworm/conf/php.ini index 75371d2..024f358 100644 --- a/8.4-frankenphp-bookworm/conf/php.ini +++ b/8.4-frankenphp-bookworm/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.4-symfony/Dockerfile b/8.4-symfony/Dockerfile index 4ce18dd..a63d72a 100644 --- a/8.4-symfony/Dockerfile +++ b/8.4-symfony/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.4-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.4-symfony/conf/php.ini b/8.4-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/8.4-symfony/conf/php.ini +++ b/8.4-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.4/Dockerfile b/8.4/Dockerfile index 4158b2b..ea03941 100644 --- a/8.4/Dockerfile +++ b/8.4/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.4-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.4/conf/php.ini b/8.4/conf/php.ini index 75371d2..024f358 100644 --- a/8.4/conf/php.ini +++ b/8.4/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.5-frankenphp-alpine/Dockerfile b/8.5-frankenphp-alpine/Dockerfile index f892271..cb0ba1d 100644 --- a/8.5-frankenphp-alpine/Dockerfile +++ b/8.5-frankenphp-alpine/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/ash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.5-frankenphp-alpine/conf/php.ini b/8.5-frankenphp-alpine/conf/php.ini index 75371d2..024f358 100644 --- a/8.5-frankenphp-alpine/conf/php.ini +++ b/8.5-frankenphp-alpine/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.5-frankenphp-bookworm/Dockerfile b/8.5-frankenphp-bookworm/Dockerfile index cda22ba..f266ee9 100644 --- a/8.5-frankenphp-bookworm/Dockerfile +++ b/8.5-frankenphp-bookworm/Dockerfile @@ -9,6 +9,7 @@ HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --r SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 ENV SERVER_NAME=:80 # git, unzip & zip are for composer diff --git a/8.5-frankenphp-bookworm/conf/php.ini b/8.5-frankenphp-bookworm/conf/php.ini index 75371d2..024f358 100644 --- a/8.5-frankenphp-bookworm/conf/php.ini +++ b/8.5-frankenphp-bookworm/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.5-symfony/Dockerfile b/8.5-symfony/Dockerfile index b7887b4..b302cbf 100644 --- a/8.5-symfony/Dockerfile +++ b/8.5-symfony/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.5-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.5-symfony/conf/php.ini b/8.5-symfony/conf/php.ini index 75371d2..024f358 100644 --- a/8.5-symfony/conf/php.ini +++ b/8.5-symfony/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/8.5/Dockerfile b/8.5/Dockerfile index f5ea7e1..14fd0d5 100644 --- a/8.5/Dockerfile +++ b/8.5/Dockerfile @@ -2,6 +2,7 @@ FROM mlocati/php-extension-installer:latest AS php-extension-installer FROM php:8.5-apache ENV COMPOSER_ALLOW_SUPERUSER=1 +ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 EXPOSE 80 WORKDIR /app diff --git a/8.5/conf/php.ini b/8.5/conf/php.ini index 75371d2..024f358 100644 --- a/8.5/conf/php.ini +++ b/8.5/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On diff --git a/README.md b/README.md index 81c20b2..424b2dd 100644 --- a/README.md +++ b/README.md @@ -68,3 +68,11 @@ These tags were last pushed on 2024-12-19. They are not part of the CI matrix an - **Symfony (`X.Y-symfony`)**: Enhanced images with additional extensions for Symfony applications (intl, zip) - **FrankenPHP Alpine (`X.Y-frankenphp-alpine`)**: Alpine-based images using FrankenPHP server for modern PHP apps - **FrankenPHP Bookworm (`X.Y-frankenphp-bookworm`)**: Debian-based images using FrankenPHP server for modern PHP apps + +## Configuration + +PHP settings of the Apache and FrankenPHP images live in `conf/php.ini` (installed as `conf.d/app.ini`). + +| Environment variable | Default | Effect | +|----------------------|---------|--------| +| `PHP_OPCACHE_VALIDATE_TIMESTAMPS` | `0` | `opcache.validate_timestamps`. With `0`, PHP files are compiled once and never checked for changes: restart the container to deploy new code. Set it to `1` when the sources are mounted and edited in place (local development). | diff --git a/_shared/conf/php.ini b/_shared/conf/php.ini index 75371d2..024f358 100644 --- a/_shared/conf/php.ini +++ b/_shared/conf/php.ini @@ -2,7 +2,12 @@ date.timezone = Europe/Paris opcache.enable = 1 opcache.enable_cli = 1 -opcache.memory_consumption = 128 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +; Files are compiled once and never checked again: restart PHP to deploy new code, or set +; PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 when the sources are mounted and edited in place. +opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS} opcache.revalidate_freq = 0 apc.enable_cli = On