Every time you execute a PHP script, the script needs to be compiled to byte code.
it is cache for this bytecode, so the next time the same script is requested, it doesn’t have to recompile it. This can save some precious execution time, and thus make your app faster (and maybe save some server costs).
opcache.enable=1
This of course, enables OPcache.
opcache.memory_consumption=512
How many Megabyte you want to assign to OPcache. Choose anything higher than 64.
opcache.interned_strings_buffer=64
How many Megabyte you want to assign to interned strings. Choose anything higher than 16.
opcache.max_accelerated_files=32531
How many scripts can be cached. Make this as close as possible (or more) to the amount of scripts in your project. Choose any of these values: 3907, 7963, 16229, 32531, 65407, 130987.
opcache.validate_timestamps=0
This will revalidate the script. If you set this to 0(best performance), you need to manually clear the OPcache every time your PHP code changes (we will handle this in the next section). If you don’t want to clear it yourself, you can set this to 1 and configure the revalidate interval with opcache.revalidate_freq, this will cost you some performance as it needs to check for changes every x seconds.
opcache.save_comments=1
This will preserve comments in your script, I recommend to keep this enabled, as some libraries depend on it, and I couldn’t find any benefits from disabling it (except from saving a few bytes RAM).
opcache.fast_shutdown=0
Fast shutdown should give a faster mechanism for clearing memory. However, in my Benchmarks it was a bit slower. Maybe it can give some improvement to your app, but you should try it for yourself.
test sync