Skip to content

Skip loading opcache.so on PHP 8.5+ - #1701

Merged
retlehs merged 1 commit into
masterfrom
php-8.5-opcache
Nov 19, 2026
Merged

retlehs merged 1 commit into
masterfrom
php-8.5-opcache

Conversation

@retlehs

@retlehs retlehs commented Nov 19, 2026

Copy link
Copy Markdown
Member

OPcache is built into PHP as of 8.5 (RFC) and no longer ships as a shared opcache.so. Sury's php8.5-common and php8.6-common packages don't include it. Only 8.4 and earlier ship phpX.Y-opcache.

10-opcache.ini.j2 always writes zend_extension=opcache.so, so with php_version: "8.5" or later PHP-FPM logs this on every start:

Warning: Failed loading Zend extension 'opcache.so' (... cannot open shared object file: No such file or directory)

It isn't fatal: OPcache still loads and the opcache.jit* settings still apply. This change writes the zend_extension line only when php_version is below 8.5.

Testing

  • Rendered the template with Ansible's version test for 8.3, 8.4, 8.5, 8.6 and 8.10. The line is kept for 8.3 and 8.4 only.
  • Reproduced the warning on PHP 8.5.12 (php:8.5-cli) with the old ini contents.

🤖 Generated with Claude Code

OPcache is built into PHP as of 8.5 and no longer ships as a shared
extension, so `zend_extension=opcache.so` makes PHP-FPM log a "Failed
loading Zend extension" warning on startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@retlehs
retlehs merged commit 78520d9 into master Nov 19, 2026
2 checks passed
@retlehs
retlehs deleted the php-8.5-opcache branch November 19, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant