How does OPcache improve performance, and what are the risks of 'stale' code in a production environment?

Last updated 15 June 2026

  • OPcache stores compiled bytecode (opcodes) in shared memory, so PHP skips reading, parsing and compiling files on every request.

  • With opcache.validate_timestamps off, PHP never checks file changes, so a deploy keeps serving stale old code until the cache is reset.

  • Reset on deploy via opcache_reset(), a PHP-FPM reload or atomic symlink swaps. Alternatively keep timestamp validation on with revalidate_freq at a small cost.

  • https://dev.to/ali83128/i-built-35-free-developer-tools-as-a-solo-dev-heres-everything-i-learned-52dj
  • https://gist.github.com/Mohamedemad4/0ab6fe607123321cf50edcc8de39ac22
All PHP interview questions