OPcache stale code PHP Origin: Application & API Last updated 13 Oct 2026

PHP still runs old code after deploy (OPcache not reset)

OPcache keeps serving cached bytecode, so changes uploaded to the server don’t take effect.

Exact message you may see OPcache stale codechanges not showing PHP
Seen on: PHP

Meaning

With opcache.validate_timestamps=0 (common in production) PHP never checks files again until FPM restarts or the cache is reset. Symlink-swap deployments also confuse realpath caches.

Common causes

  • validate_timestamps disabled
  • Deploy without reloading PHP-FPM
  • Symlink-based deploys with realpath cache

⚡ Quick fix

  1. Reload PHP-FPM after each deploy (systemctl reload php8.2-fpm)
  2. Call opcache_reset() via a protected endpoint
  3. Use $realpath_root in Nginx for symlink deploys

Detailed fix by platform

Nginx

  1. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

How to diagnose

  1. Setting — opcache.validate_timestamps value
  2. Deploy — Is FPM reloaded?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

App Service Application Error — Azure App Service: ":( Application Error" / container didn’t respond to HTTP pings (Azure)App Service Applicati…ChunkLoadError — ChunkLoadError: Loading chunk 123 failed. (JavaScript)ChunkLoadErrorFileNotFoundException assembly — Could not load file or assembly 'X, Version=…' or one of its dependencies (.NET)FileNotFoundException…MIME type not executable — Refused to execute script from 'x' because its MIME type ('text/html') is not executable (JavaScript)MIME type not executa…module MIME type — Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html" (JavaScript)module MIME typePrimary script unknown — FastCGI sent in stderr: "Primary script unknown" (PHP)Primary script unknownUnexpected token < — SyntaxError: Unexpected token '<' (HTML served instead of JavaScript) (JavaScript)Unexpected token <You must install or update .NET to run this application — The framework 'Microsoft.NETCore.App', version '8.0.0' (x64) was not found. You must install or update .NET to run this application (.NET)You must install or u…OPcache s…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.