PHP OPcache Serving Old Code After Atomic Symlink Deployment

OPcache `realpath_cache` resolved the previous release directory path for 120s.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: PHP OPcache Serving Old Code After Atomic Symlink Deployment Platform: PHP
Common Root Causes:
  • OPcache `realpath_cache` resolved the previous release directory path for 120s.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Reload `php-fpm` (`systemctl reload php8.3-fpm`) after swapping the release symlink.
Safe Diagnostic Command:
php -i | grep -E "opcache|realpath_cache"
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

OPcache `realpath_cache` resolved the previous release directory path for 120s. Recommended diagnostic: `php -i | grep -E "opcache|realpath_cache"`. Remediation: Reload `php-fpm` (`systemctl reload php8.3-fpm`) after swapping the release symlink.

Worked Examples

  • Run `php -i | grep -E "opcache|realpath_cache"` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-php-opcache-stale-symlink-deploy · Independently verified: 2026-11-25

Related Resources