From 0b384c003516f34abc33b6ff934c409882286167 Mon Sep 17 00:00:00 2001 From: Andrei Condurachi Date: Wed, 18 Nov 2020 15:18:59 +0200 Subject: [PATCH] PHP ini config updates --- Dockerfile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7e59890..0b959fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,16 +32,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php RUN { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - echo 'opcache.fast_shutdown=1'; \ - echo 'opcache.enable_cli=1'; \ - echo 'upload_max_filesize=128M'; \ - echo 'post_max_size=128M'; \ - echo 'expose_php=off'; \ + echo 'opcache.memory_consumption=128'; The size of the shared memory storage used by OPcache, in megabytes \ + echo 'opcache.interned_strings_buffer=8'; The amount of memory used to store interned strings, in megabytes \ + echo 'opcache.max_accelerated_files=4000'; The maximum number of keys (and therefore scripts) in the OPcache hash table \ + echo 'opcache.revalidate_freq=60'; How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request \ + echo 'opcache.enable_cli=1'; Enables the opcode cache for the CLI version of PHP \ + echo 'upload_max_filesize=128M'; The maximum size of an uploaded file \ + echo 'post_max_size=128M'; Sets max size of post data allowed \ + echo 'expose_php=off'; Exposes to the world that PHP is installed on the server, which includes the PHP version within the HTTP header \ } > /usr/local/etc/php/conf.d/php-recommended.ini +# opcache.fast_shutdown - This directive has been removed in PHP 7.2.0. A variant of the fast shutdown sequence has been integrated into PHP and will be automatically used if possible. + +# Additional, performance related configs +RUN { \ + echo 'opcache.enable_file_override=1'; When enabled, the opcode cache will be checked for whether a file has already been cached when file_exists(), is_file() and is_readable() are called. This may increase performance in applications that check the existence and readability of PHP scripts, but risks returning stale data if opcache.validate_timestamps is disabled. \ + echo 'opcache.validate_timestamps=1'; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds. When this directive is disabled, you must reset OPcache manually via opcache_reset(), opcache_invalidate() or by restarting the Web server for changes to the filesystem to take effect. \ + echo 'opcache.revalidate_path=1'; If disabled, existing cached files using the same include_path will be reused. Thus, if a file with the same name is elsewhere in the include_path, it will not be found. \ + echo 'opcache.save_comments=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. \ + echo 'opcache.use_cwd=1'; If enabled, OPcache appends the current working directory to the script key, thereby eliminating possible collisions between files with the same base name. Disabling this directive improves performance, but may break existing applications. \ + } >> /usr/local/etc/php/conf.d/php-recommended.ini RUN pecl install apcu \ && pecl install yaml-2.0.4 \