As I have put on quite a few articles recently, this is a boring data aggregation article; for a thing I need to know, but not very often.

Recent versions of PHP ship with a byte code cache. If you have no opcache (and lack similar features), 50% of execution time is compiling the source 1. For PHP v5, this was called APC 2, and it deprecates several projects, including commercial products. For PHP v7, use Opcache 3 instead; the new (but standard for most other programming languages) AST 4 means they needed to write a new one.
The following notes are PHP7, as that is what people should be using. According to 5, you get a performance benefit by using Opcache even if you are using mod_php, where PHP processes are created for each HTTP(S) request. The opcache module has alot of config items 6. There are more detailed notes in 7. As ever, the internet says you will have problems if you use a MSFT product for anything important. The only method a developer is likely to use is opcache_get_status 8, this module doesn't expose many functions. The opcache is much simpler to use than the previous versions of PHP 9 10. There are some performance notes 11

Extremely obvious disclaimer: as the opcache is a memory cache, enabling it increases your RAM in use. This is important for VM with limited RAM.
Second extremely obvious disclaimer: As this is caching op codes, in order to make a code deployment have effect; you need to restart the cache. Either write a cache purge script, or restart all the PHP processes.

The below is a operational config for this feature. I am posting this as I note several internet sources had errors in them, as though the author didn't proof read their articles. The default config supplied by the package manager includes quite good documentation.


opcache.enable=1
opcache.enable_cli=1
opcache.revalidate_freq=3600
opcache.validate_timestamps=0
opcache.max_accelerated_files=20000
opcache.memory_consumption=128
opcache.blacklist_filename=/etc/php.d/opcache*.blacklist
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1
; suppressing these two bundles, or they will flood the cache, but not be used often.
; variables are for humans to interpret
$bundleroot/vendor/mpdf/*
$bundleroot/vendor/swiftmailer/*