From 913d2a374d9e54ed449e02add9e0f41717a59a75 Mon Sep 17 00:00:00 2001 From: Bryan Latten Date: Fri, 10 Jul 2015 18:18:02 -0400 Subject: [PATCH] Opcache: detect debug env var, set performance --- container/root/etc/php5/mods-available/opcache.ini | 14 ++++++++++++++ container/root/run.sh | 9 +++++++++ 2 files changed, 23 insertions(+) create mode 100644 container/root/etc/php5/mods-available/opcache.ini diff --git a/container/root/etc/php5/mods-available/opcache.ini b/container/root/etc/php5/mods-available/opcache.ini new file mode 100644 index 0000000..0a07548 --- /dev/null +++ b/container/root/etc/php5/mods-available/opcache.ini @@ -0,0 +1,14 @@ +; configuration for php ZendOpcache module +; priority=05 +zend_extension=opcache.so + +; Tuning from explanations here: https://www.scalingphpbook.com/best-zend-opcache-settings-tuning-config/ +opcache.enable=1 +opcache.max_accelerated_files=15000 +opcache.memory_consumption=128 +opcache.fast_shutdown=1 +opcache.interned_strings_buffer=16 + +; These get added by run.sh in a production-mode environment +;opcache.revalidate_freq=0 +;opcache.validate_timestamps=0 diff --git a/container/root/run.sh b/container/root/run.sh index 9988427..79317bd 100755 --- a/container/root/run.sh +++ b/container/root/run.sh @@ -18,6 +18,15 @@ else echo $ENV >> $DEST_CONF done + if [[ $CFG_APP_DEBUG = 1 || $CFG_APP_DEBUG = '1' || $CFG_APP_DEBUG = 'true' ]] + then + echo 'Opcache set to WATCH for file changes' + else + echo 'Opcache set to PERFORMANCE' + echo 'opcache.revalidate_freq=0' >> /etc/php5/mods-available/opcache.ini + echo 'opcache.validate_timestamps=0' >> /etc/php5/mods-available/opcache.ini + fi + echo 'Enabling Docker Config' a2enconf docker-environment