fix(opcache): remove leftover opcache.ini for PHP >= 8.5#598
Open
potsky wants to merge 1 commit into
Open
Conversation
OPCache became a required, statically-built extension in PHP 8.5 (https://wiki.php.net/rfc/opcache-required), so it can no longer be loaded as an external Zend extension and the shared `opcache.so` file is no longer shipped. The `support/package_php` script was updated in bcc5875 to stop writing `etc/conf.d/opcache.ini` when packaging PHP >= 8.5. However, PHP 8.5 binaries packaged before that fix still contain this file, and they remain the ones currently served to apps using PHP 8.5.x. As a result, every PHP invocation emits: PHP Warning: Failed loading Zend extension 'opcache.so' (tried: /app/vendor/php/lib/php/extensions/no-debug-non-zts-20250925/opcache.so (... cannot open shared object file: No such file or directory) ...) in Unknown on line 0 The warning is harmless at runtime (OPCache is statically active and listed by `php -m` as `Zend OPcache`), but it pollutes every command: `composer install`, `php artisan` calls, Horizon worker logs, the build output, and `scalingo run php -m` itself. This change defensively removes the obsolete file at slug-compile time when PHP >= 8.5, regardless of how the downloaded PHP binary was packaged. The behaviour for PHP < 8.5 is unchanged.
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.
Context
OPCache became a required, statically-built extension in PHP 8.5 (opcache-required RFC), so it can no longer be loaded as an external Zend extension and the shared
opcache.sofile is no longer shipped.support/package_phpwas already updated in bcc5875 to stop writingetc/conf.d/opcache.iniwhen packaging PHP >= 8.5.However, PHP 8.5 binaries packaged before that fix still contain the
obsolete file, and they remain the ones currently served to apps using
PHP 8.5.x on
scalingo-22(the8.5.6build forno-debug-non-zts-20250925fetched from the Swift bucket).
Symptom
Every PHP invocation during build and runtime emits:
This appears for every:
composer installinvocation (post-install scripts,package:discover, etc.)php artisancall during buildscalingo run php -m(which still correctly reportsZend OPcacheas built-in)OPCache itself is active (built into the binary), so there is no runtime
impact — but the warning pollutes every log line.
Fix
Remove
${VENDORED_PHP}/etc/conf.d/opcache.inidefensively inbin/compilewhen PHP >= 8.5, immediately after
fetch_engine_package phpand aftersourcing
.profile.d/php.sh(sophp_api_version()andPHP_MODULE_API_VERSIONSare both available).This works regardless of whether the downloaded PHP binary was packaged
before or after bcc5875, and is a no-op once the PHP 8.5 binary is
re-released without the file. Behavior for PHP < 8.5 is unchanged.
Reproduction
Any app declaring
"php": "8.5.*"incomposer.jsononscalingo-22reproduces the warning during build and runtime.
Test
Bash syntax checked locally with
bash -n bin/compile.