Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR serves to clean-up the OPcache configurations in opcache.ini.sh.
Removed configurations
These configurations were removed as they are already the defaults in PHP (see PHP OPcache configuration docs):
These configurations were also removed, with justifications:
opcache.fast_shutdown directive was removed since PHP 7.2.0 (see opcache.fast_shutdown configuration). Similar PR:
opcache.enable_cli=1 was removed from Nextcloud's recommended configurations due to it being bad for performance. See issue:
Recommended configurations
These are recommended configurations (see Enabling PHP OPcache - Nextcloud docs):
opcache.save_comments is required by Nextcloud. However, it is also the default value in PHP, therefore removed.
OR
opcache.revalidate_freq is recommended to be set to '60' to revalidate cached scripts every 60 seconds (as opposed to the 2 seconds default in PHP). The revalidation frequency can be disabled by setting opcache.validate_timestamps to '0'.
Other recommended configuration by Nextcloud (undocumented):
Nextcloud have increased opcache.interned_strings_buffer from '8' to '16' to avoid the following error message:
See PR:
Personally, I have tested the configuration by modifying /etc/php/8.1/mods-available/opcache.ini and there were no issues after restarting the service.
However, if any issues arises after restarting the service, I would recommend to clear the file cache in /tmp and then restarting the service.
Note that I have tested this on a Docker instance instead of a bare metal installation.