Stack Matrix Hub (8)
PHP OPcache & Symlink realpath_cache_size Gotchas on Clones
Fix stale PHP class caching and cross-branch file bleed when running multiple WordPress clones on symlinked or shared PHP-FPM pools.
realpath_cache_size=4096K · validate_timestamps=1 · Dedicated pool per branch
Why Symlinked Staging Deployments Serve Stale PHP Files
When PHP OPcache runs with opcache.validate_timestamps=0 or resolves symlinked docroots through a shared realpath cache, editing functions.php on staging-qa can keep executing cached bytecode from an older release symlink for up to 120 seconds.
Isolating OPcache Keys Across Staging Branches
Keep opcache.validate_timestamps=1 and opcache.revalidate_freq=2 on staging pools, or assign distinct PHP-FPM / LSAPI socket pools per staging subdomain so OPcache memory segments never collide with production.
Measured Thresholds & Configuration
| PHP Runtime Setting | Production Value | Staging Clone Value |
|---|---|---|
| opcache.validate_timestamps | 0 (manual flush on deploy) | 1 (auto-detect QA edits) |
| opcache.revalidate_freq | 60s+ | 2s (instant dev feedback) |
| LSAPI / PHP-FPM Pool | Isolated live pool | Separate staging pool + memory cap |