Skip to content

fix(opcache): remove leftover opcache.ini for PHP >= 8.5#598

Open
potsky wants to merge 1 commit into
Scalingo:masterfrom
potsky:fix/php-85-opcache-warning-leftover-ini
Open

fix(opcache): remove leftover opcache.ini for PHP >= 8.5#598
potsky wants to merge 1 commit into
Scalingo:masterfrom
potsky:fix/php-85-opcache-warning-leftover-ini

Conversation

@potsky
Copy link
Copy Markdown

@potsky potsky commented May 22, 2026

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.so file is no longer shipped.

support/package_php was already 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 the
obsolete file
, and they remain the ones currently served to apps using
PHP 8.5.x on scalingo-22 (the 8.5.6 build for no-debug-non-zts-20250925
fetched from the Swift bucket).

Symptom

Every PHP invocation during build and runtime emits:

PHP Warning:  Failed loading Zend extension 'opcache.so'
(tried: /app/vendor/php/lib/php/extensions/no-debug-non-zts-20250925/opcache.so
(/app/vendor/php/lib/php/extensions/no-debug-non-zts-20250925/opcache.so: cannot open shared object file: No such file or directory),
/app/vendor/php/lib/php/extensions/no-debug-non-zts-20250925/opcache.so.so
(/app/vendor/php/lib/php/extensions/no-debug-non-zts-20250925/opcache.so.so: cannot open shared object file: No such file or directory))
in Unknown on line 0

This appears for every:

  • composer install invocation (post-install scripts, package:discover, etc.)
  • php artisan call during build
  • Horizon worker startup
  • Scheduler tick
  • scalingo run php -m (which still correctly reports Zend OPcache as 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.ini defensively in bin/compile
when PHP >= 8.5, immediately after fetch_engine_package php and after
sourcing .profile.d/php.sh (so php_api_version() and
PHP_MODULE_API_VERSIONS are 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.*" in composer.json on scalingo-22
reproduces the warning during build and runtime.

Test

Bash syntax checked locally with bash -n bin/compile.

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.
@EtienneM EtienneM requested a review from Frzk May 26, 2026 05:37
Copy link
Copy Markdown
Contributor

@Frzk Frzk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot @potsky <3

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.

3 participants