Skip to content

Commit

Permalink
Merge pull request #36 from bryanlatten/opcache-optimization
Browse files Browse the repository at this point in the history
Opcache: detect debug env var, set performance
  • Loading branch information
Bryan Latten committed Jul 10, 2015
2 parents 48b79b5 + 913d2a3 commit e5a7aac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions container/root/etc/php5/mods-available/opcache.ini
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions container/root/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e5a7aac

Please sign in to comment.