fix(php8): remove duplicate OPcache loader on PHP <= 8.4#91
Open
lussoluca wants to merge 2 commits into
Open
Conversation
The official php:8.x-fpm image already enables OPcache via docker-php-ext-opcache.ini (zend_extension=opcache). Adding a second 00-opcache-load.ini (zend_extension=opcache.so) made PHP load OPcache twice on PHP <= 8.4, emitting 'Cannot load Zend OPcache - it was already loaded' at every invocation. On PHP 8.5 OPcache is statically compiled, so the guard never created the file there anyway. The block only ever fired on <= 8.4, exactly where the parent image already loads OPcache, so it was always redundant. opcache.ini still tunes OPcache in both cases; it carries no zend_extension line. Assisted-by: claude-code/claude-opus-4-8
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
opcache.fast_shutdown was removed in PHP 7.2 — fast shutdown became always-on and the directive no longer exists. PHP 8.4 does not list it in phpinfo() and ini_get() returns false, so the line in 8/conf/opcache.ini is silently ignored dead config. The 8/ image only targets PHP 8.x, so it can never apply. Remove it. Assisted-by: claude-code/claude-opus-4-8
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.
Problem
Since
e9b6e49("feat(php8): add PHP 8.5.7 and refresh image dependencies"), the 8.x image emits at every PHP invocation:Reproduced on the
8.4.22-fpm-alpine3.24-rootlesstag. The8.4.2tag (built before that commit) is clean.Root cause
The official parent
php:8.x-fpm-alpineimage already enables OPcache viadocker-php-ext-opcache.ini(zend_extension=opcache). Commite9b6e49added a second loader:On PHP <= 8.4 both loaders run → OPcache loads twice → the warning. On PHP 8.5 OPcache is statically compiled,
opcache.sois absent, so the guard never created the file there. The block only ever fired on <= 8.4, exactly where the parent already loads OPcache — always redundant.Fix
Remove the block.
opcache.inistill tunes OPcache in both cases (it carries nozend_extensionline); the parent loads it on <= 8.4 and it is static on 8.5.Additional cleanup: drop dead
opcache.fast_shutdown8/conf/opcache.inisetopcache.fast_shutdown=1. That directive was removed in PHP 7.2 — fast shutdown became always-on and the option no longer exists. On PHP 8.4 it is absent fromphpinfo()andini_get("opcache.fast_shutdown")returnsfalse, so the line is silently ignored dead config. The8/image only targets PHP 8.x, so it can never apply. Removed.Verification
In the affected
8.4.22image, two loaders are present:After this change only the parent's
docker-php-ext-opcache.iniremains, OPcache stays enabled, and the warning is gone. Verified locally by building the PR branch (--build-arg PHPVER=8.4.22-fpm-alpine3.24, targetsdistanddev): single loader, no warning,extension_loaded("Zend OPcache")→true, andopcache_get_status()["opcache_enabled"]→truewithopcache.enable_cli=1.Assisted-by: claude-code/claude-opus-4-8