What is OPcache, and how does it improve the execution speed of PHP scripts?

Last updated 15 June 2026

  • OPcache is a bundled extension that caches precompiled bytecode (opcodes) in shared memory.

  • Without it, every request re-reads, tokenizes, parses and compiles each file. With it, requests skip straight to execution, saving CPU and disk I/O.

  • Tune it with opcache.memory_consumption, opcache.max_accelerated_files and opcache.validate_timestamps for faster responses with no code changes.

  • https://www.php.net/manual/en/book.opcache.php
  • https://www.geeksforgeeks.org/php/how-to-use-php-opcache/
All PHP interview questions