Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added custom opcache config override #2275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bronco0
Copy link

@bronco0 bronco0 commented Aug 13, 2024

Added the ability to customize PHP OPcache configuration.
Default values ​​have been set to environment variables that can be overridden.

Signed-off-by: Jonathan Rousseau <[email protected]>
@J0WI
Copy link
Contributor

J0WI commented Sep 18, 2024

This adds a lot of new envs. Do you require all of them?

@bronco0
Copy link
Author

bronco0 commented Sep 19, 2024

I think it's a good idea to be able to customize any OPcache setting.

@J0WI
Copy link
Contributor

J0WI commented Sep 22, 2024

I'm a bit worried to add that many ENVs. I can imagine some cases where it's useful to adjust the numbers but why would you change opcache.save_comments or opcache.jit? IMHO ENVs should only exist for common use cases and everything else can still be configured by mounting additional config files into the container.

@@ -217,6 +217,15 @@ To customize Apache max file upload limit you can change the following variable:
- `APACHE_BODY_LIMIT` (default `1073741824` [1GiB]) This restricts the total
size of the HTTP request body sent from the client. It specifies the number of _bytes_ that are allowed in a request body. A value of **0** means **unlimited**. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html#apache) for more information.

To customize OPcache parameters you can change the following variables:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -217,6 +217,15 @@ To customize Apache max file upload limit you can change the following variable:
- `APACHE_BODY_LIMIT` (default `1073741824` [1GiB]) This restricts the total
size of the HTTP request body sent from the client. It specifies the number of _bytes_ that are allowed in a request body. A value of **0** means **unlimited**. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html#apache) for more information.

To customize OPcache parameters you can change the following variables:
- `PHP_OPCACHE_INTERNED_STRINGS_BUFFER` (default `32`) The amount of memory used to store interned strings, in megabytes.
- `PHP_OPCACHE_MAX_ACCELERATED_FILES` (default `10000`) The maximum number of keys (and therefore scripts) in the OPcache hash table. The actual value used will be the first number in the set of prime numbers { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 } that is greater than or equal to the configured value. The minimum value is 200. The maximum value is 1000000. Values outside of this range are clamped to the permissible range.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be too verbose here and copy the whole upstream documentation. Just link to https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.max-accelerated-files for further details.

- `PHP_OPCACHE_MAX_ACCELERATED_FILES` (default `10000`) The maximum number of keys (and therefore scripts) in the OPcache hash table. The actual value used will be the first number in the set of prime numbers { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 } that is greater than or equal to the configured value. The minimum value is 200. The maximum value is 1000000. Values outside of this range are clamped to the permissible range.
- `PHP_OPCACHE_MEMORY_CONSUMPTION` (default `128`) The size of the shared memory storage used by OPcache, in megabytes. The minimum permissible value is "8", which is enforced if a smaller value is set.
- `PHP_OPCACHE_SAVE_COMMENT` (default `1`) If disabled, all documentation comments will be discarded from the opcode cache to reduce the size of the optimised code. Disabling this configuration directive may break applications and frameworks that rely on comment parsing for annotations, including Doctrine, Zend Framework 2 and PHPUnit.
- `PHP_OPCACHE_REVALIDATE_FREQ` (default `60`) How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants