Repository navigation
Make opcache.enable configurable via PHP_OPCACHE_ENABLE - #3
Merged
Merged
Conversation
Every other opcache setting in docker-configure is env-driven, but opcache.enable was left as a literal. It isn't a deliberate safety decision: 1e756b1 originally hardcoded all of them (memory_consumption, validate_timestamps, jit, ...) and later work parameterized the rest without reaching this line. Defaults to 1 via ${PHP_OPCACHE_ENABLE:-1}, so behavior is unchanged for every existing image and container -- an unset var still yields opcache.enable = 1. This follows the same fallback discipline the file already commits to for JIT: if the env var is missing, fall back to the safe value rather than PHP's own default. The knob matters for CI and debugging: opcache's optimizer distorts line-level code coverage, which is the usual reason to want it off. Disabling opcache in production remains a bad idea, but the blast radius was already reachable -- PHP_OPCACHE_MEMORY=1 or PHP_OPCACHE_MAX_FILES=1 are just as silently catastrophic and have always been exposed. Also fix a CI gap found along the way: detect-changes watched the Dockerfile paths but not docker-configure, so a change to that file alone would have silently shipped nothing despite it rendering all of app.ini at container boot. Added it to the watched paths and to the 20 job conditions that key off the base Dockerfile, so base, dev and wordpress variants all rebuild when it changes. Verified against ghcr.io/aliasproject/php:8.4-frankenphp: unset -> 1, PHP_OPCACHE_ENABLE=0 -> 0 in app.ini and in ini_get() at runtime. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MuahHB9waqScWSrf9UxpvL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
opcache.enablewas the one hardcoded value indocker-configureamong env-driven neighbours:plus
ENV PHP_OPCACHE_ENABLE=1in the four frankenphp base Dockerfiles (8.2–8.5). WordPress and dev variants areFROMthe base, so they inherit it with no edit.Why it's not a deliberate safety decision
1e756b1originally hardcoded every opcache value —memory_consumption,validate_timestamps,jit,jit_buffer_size. Later work parameterized the rest and simply didn't reach this line.Disabling opcache in production remains a bad idea, but the blast radius was already reachable:
PHP_OPCACHE_MEMORY=1orPHP_OPCACHE_MAX_FILES=1are just as silently catastrophic and have always been exposed. The real use for the knob is CI and debugging — opcache's optimizer distorts line-level code coverage.No behavior change
The
${PHP_OPCACHE_ENABLE:-1}fallback means an unset var still yieldsopcache.enable = 1, so existing images and running containers are unaffected. Same fallback discipline the file already commits to for JIT atdocker-configure:29-33.Verified against
ghcr.io/aliasproject/php:8.4-frankenphp:app.iniini_get()opcache.enable = 1PHP_OPCACHE_ENABLE=0opcache.enable = 00Drive-by CI fix
detect-changeswatched theDockerfilepaths but notdocker-configure— so a change to that file alone would have silently shipped nothing, despite it rendering all ofapp.iniat container boot. Added it to the watched paths and to the 20 job conditions that key off the base Dockerfile, so base, dev and wordpress variants all rebuild when it changes.🤖 Generated with Claude Code
https://claude.ai/code/session_01MuahHB9waqScWSrf9UxpvL