Without opcache, PHP reads and compiles every file on every request - the same work, thousands of times a minute, for files that have not changed. opcache keeps the compiled form in memory. It is usually the biggest single improvement available, and it is one setting.

opcache.enable=1
opcache.memory_consumption=192
opcache.max_accelerated_files=20000
opcache.validate_timestamps=1
opcache.revalidate_freq=2

Check it is actually on

php -i | grep -E 'opcache.enable|opcache.memory'
# or, in a page you can reach:
print_r(opcache_get_status()['opcache_statistics']);
  • opcache_hit_rate below 95% - memory_consumption is too small and it is evicting files it will need again.
  • num_cached_keys near max_accelerated_files - raise the file limit; a large framework has more files than the default allows.

What it does NOT do

It caches compiled code, not results. A slow query is exactly as slow with opcache on. If your page is slow because of what it asks the database, this changes nothing - and that is the most common disappointment.

The setting that hides a deploy

opcache.validate_timestamps=0 is faster and means PHP never checks whether a file changed. Your deploy goes out and the site keeps serving the old code, with no error anywhere. If you set it, your deploy MUST reset the cache.
# after deploying, with validate_timestamps=0\ncachetool opcache:reset\n# or reload the pool\nsystemctl reload php8.3-fpm
On EGPHP hosting opcache is on and tuned for the pool. This page is for a VPS you run yourself.