From a9f904060e63008962db40eae7793a1dd5c21b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A8ve=20Caillault?= Date: Sat, 28 Feb 2026 10:20:39 +0100 Subject: [PATCH] Configuration d'OPcache avec FrankenPHP. --- .env.example | 3 +++ docker-compose.frankenphp.yml | 1 + host/php/conf/opcache.default.ini | 11 +++++++++++ host/php/conf/opcache.dev.ini | 12 ++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 host/php/conf/opcache.default.ini create mode 100644 host/php/conf/opcache.dev.ini diff --git a/.env.example b/.env.example index 792e66f..a5c58ad 100644 --- a/.env.example +++ b/.env.example @@ -23,6 +23,9 @@ APACHE_ADMIN_EMAIL="" # FrankenPHP FRANKENPHP_VERSION="dunglas/frankenphp:1.11.2-php8.5" +# Nom du fichier de configuration OPcache à utiliser +OPCACHE_CONFIG_FILE="opcache.dev.ini" + # PHPMyAdmin PHPMYADMIN_IMAGE="phpmyadmin:5.2-apache" PHPMYADMIN_URL="" diff --git a/docker-compose.frankenphp.yml b/docker-compose.frankenphp.yml index 43068f3..766d50e 100644 --- a/docker-compose.frankenphp.yml +++ b/docker-compose.frankenphp.yml @@ -10,6 +10,7 @@ services: volumes: - ./www:/app - ./host/frankenphp/conf/Caddyfile:/etc/frankenphp/Caddyfile + - ./host/php/conf/${OPCACHE_CONFIG_FILE:-opcache.default.ini}:/usr/local/etc/php/conf.d/opcache.ini healthcheck: test: [ "CMD-SHELL", "curl -s http://localhost/server-php-test.php || exit 1" ] diff --git a/host/php/conf/opcache.default.ini b/host/php/conf/opcache.default.ini new file mode 100644 index 0000000..1b34808 --- /dev/null +++ b/host/php/conf/opcache.default.ini @@ -0,0 +1,11 @@ +# Configuration de OPcache pour un environnement de production +# JIT est activé et OPcache vérifie les modifications toutes les 60 secondes + +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=128 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=60 +opcache.jit=1255 +opcache.jit_buffer_size=128M \ No newline at end of file diff --git a/host/php/conf/opcache.dev.ini b/host/php/conf/opcache.dev.ini new file mode 100644 index 0000000..7fac710 --- /dev/null +++ b/host/php/conf/opcache.dev.ini @@ -0,0 +1,12 @@ +# Configuration de OPcache pour un environnement de développement +# JIT est désactivé et OPcache vérifie les modifications à chaque requête + +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=128 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.validate_timestamps=0 +opcache.revalidate_freq=0 +opcache.jit=0 +opcache.jit_buffer_size=0 \ No newline at end of file