what is the proper opcache configuration when using PHP for CLI only?
I find very confusing/old resources and am not sure this is the proper conf:
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.file_cache=/tmp/php-opcache
More specifically: the doc describe opcache.file_cache
as a second level cache, SHM memory being the 1st level. But I can't find any recent resource indicating whether the SHM memory is shared across PHP's cli invocations depending on this, either opcache.file_cache
isn't nescessary or opcache.file_cache_only
is required.
Secondly, I'd like to determine the required management over the content of the directory that opcache.file_cache
points to
Thanks to @Chris Haas comments, I've got some informations, but don't consider this answer as comprehensive: there are a lot of unknown around using the opcache for CLI.
Properly enabling the opcache for CLI only require this conf:
[opcache]
opcache.enable_cli=1
opcache.file_cache=/tmp/php-opcache
opcache.file_cache_only=1
notes:
opcache.validate_timestamps
/opcache.revalidate_freq
, but the choice will depend for example of your environment (dev/prod)max_wasted_percentage
(just to be clear: the doc don't state this, it's just an educated guess)opcache.file_cache
point to:interesting ressources:
Personally, I convinced my team to not enable this feature "opcache for CLI", because I think there a too much dark corners.