OPcache settings that actually matter in production

OPcache has shipped with PHP since 5.5 and is disabled in several distribution builds, which means a good number of production servers are compiling every file on every request. Enabling it is the single cheapest performance change available.

opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.validate_timestamps=1
opcache.revalidate_freq=2

max_accelerated_files is the one people leave at the default: at 2000 it is smaller than a framework, so files past the limit are recompiled every request and the cache appears not to work. Count the PHP files in the deploy and round up. Setting validate_timestamps=0 removes the stat call per file and is the fastest configuration, but the cache then only changes when it is explicitly reset — which means the deploy must do it, or a release will not take effect.