Skip to content

Commit

Permalink
opcache and php best practice settings for Mage2
Browse files Browse the repository at this point in the history
  • Loading branch information
gaiterjones committed Sep 3, 2020
1 parent 41fea9a commit 89ad9e3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Docker containers for Magento 2.4.x development including :

docker exec -i -t --user magento magento2_php-apache_1 install-magento

7. Disable 2FA for testing

docker exec -i -t --user magento magento2_php-apache_1 bin/magento module:disable Magento_TwoFactorAuth

## Test

Expand Down
2 changes: 2 additions & 0 deletions magento2/manager/magento2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
# Ensure old PID due to previous usage killed
RUN rm -f /var/run/apache2/apache2.pid

# configs
#
Expand Down
7 changes: 5 additions & 2 deletions magento2/manager/magento2/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ always_populate_raw_post_data = -1
flag session.auto_start = off
zlib.output_compression = on
suhosin.session.cryptua = off
realpath_cache_size = 10M
realpath_cache_ttl = 300

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
Expand All @@ -43,10 +45,11 @@ short_open_tag = On

opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256M
opcache.max_accelerated_files = 40000
opcache.memory_consumption = 1024M
opcache.max_accelerated_files = 65535
opcache.revalidate_freq = 0
opcache.revalidate_path = 1
opcache.save_comments = 1

[Date]
date.timezone = "Europe/London"
Expand Down
2 changes: 2 additions & 0 deletions magento2/ubuntu/magento240-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
# Ensure old PID due to previous usage killed
RUN rm -f /var/run/apache2/apache2.pid

# cleanup
#
Expand Down
29 changes: 24 additions & 5 deletions magento2/ubuntu/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,24 @@
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 1800
max_input_time = 60
memory_limit=2048M
max_execution_time = 18000
max_input_time = 300
memory_limit=4096M
upload_max_filesize = 32M
post_max_size = 32M
max_input_vars=5000

;;;;;;;;;;;;;;;;;;;
; MAGE ;
;;;;;;;;;;;;;;;;;;;
; https://github.com/magento/magento2/blob/2.2/php.ini.sample

always_populate_raw_post_data = -1
flag session.auto_start = off
zlib.output_compression = on
suhosin.session.cryptua = off
realpath_cache_size = 10M
realpath_cache_ttl = 300

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
Expand All @@ -31,10 +45,11 @@ short_open_tag = On

opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256M
opcache.max_accelerated_files = 40000
opcache.memory_consumption = 1024M
opcache.max_accelerated_files = 65535
opcache.revalidate_freq = 0
opcache.revalidate_path = 1
opcache.save_comments = 1

[Date]
date.timezone = "Europe/London"
Expand All @@ -44,3 +59,7 @@ sendmail_path = /usr/bin/msmtp -t -i

; dev / prod
;expose_php = off
; disable xdebug in build
;xdebug.remote_autostart=0
;xdebug.remote_enable=0
;display_errors = Off

0 comments on commit 89ad9e3

Please sign in to comment.