From e0294b65ac740ea7ce6c900e5d7e71176ad4f7e6 Mon Sep 17 00:00:00 2001 From: Thomas Clavier Date: Fri, 17 Jan 2025 00:31:57 +0100 Subject: [PATCH] use var PHP_OPCACHE_MEMORY_CONSUMPTION for configuration (#2090) * use var PHP_OPCACHE_MEMORY_CONSUMTION for configuration Signed-off-by: Thomas Clavier * Use PHP_OPCACHE_MEMORY_CONSUMTION in Dockerfile-alpine.template Signed-off-by: Thomas Clavier * fix typo : CONSUMTION -> CONSUMPTION * Add opcache.memory_consumption documentation * fix typo --------- Signed-off-by: Thomas Clavier --- Dockerfile-alpine.template | 3 ++- Dockerfile-debian.template | 3 ++- README.md | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index de69eef2..f7568e73 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -88,11 +88,12 @@ RUN set -ex; \ # see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache ENV PHP_MEMORY_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M +ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128 RUN { \ echo 'opcache.enable=1'; \ echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.max_accelerated_files=10000'; \ - echo 'opcache.memory_consumption=128'; \ + echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.save_comments=1'; \ echo 'opcache.revalidate_freq=60'; \ echo 'opcache.jit=1255'; \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 8b66dd34..792c9fe2 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -20,6 +20,7 @@ RUN set -ex; \ # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html ENV PHP_MEMORY_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M +ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128 RUN set -ex; \ \ savedAptMark="$(apt-mark showmanual)"; \ @@ -97,7 +98,7 @@ RUN { \ echo 'opcache.enable=1'; \ echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.max_accelerated_files=10000'; \ - echo 'opcache.memory_consumption=128'; \ + echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.save_comments=1'; \ echo 'opcache.revalidate_freq=60'; \ echo 'opcache.jit=1255'; \ diff --git a/README.md b/README.md index 6fdd5ec9..03de4339 100644 --- a/README.md +++ b/README.md @@ -300,6 +300,7 @@ Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/adm To customize PHP limits you can change the following variables: - `PHP_MEMORY_LIMIT` (default `512M`) This sets the maximum amount of memory in bytes that a script is allowed to allocate. This is meant to help prevent poorly written scripts from eating up all available memory but it can prevent normal operation if set too tight. - `PHP_UPLOAD_LIMIT` (default `512M`) This sets the upload limit (`post_max_size` and `upload_max_filesize`) for big files. Note that you may have to change other limits depending on your client, webserver or operating system. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html) for more information. +- `PHP_OPCACHE_MEMORY_CONSUMPTION` (default `128`) This sets the `opcache.memory_consumption` value. It's the size of the shared memory storage used by OPcache, in megabytes. ### Apache Configuration