Skip to content

Commit

Permalink
configure opcache for fpm and disable for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Apr 16, 2016
1 parent 4ead1f8 commit 339b74e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
when: phpfpm.stat.exists

- include: php-cli.yml
when: phpcli.stat.exists
when: phpcli.stat.exists
6 changes: 3 additions & 3 deletions tasks/php-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
regexp='date.timezone ='
line='date.timezone = {{ php_timezone }}'

- name: Enabling opcache cli
- name: disabling opcache cli
lineinfile: dest=/etc/php/7.0/cli/php.ini
regexp=';?opcache.enable_cli='
line='opcache.enable_cli=1'
regexp='opcache.enable_cli='
line='opcache.enable_cli=0'
49 changes: 49 additions & 0 deletions tasks/php-fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,52 @@
regexp='max_execution_time(\s)?='
line='max_execution_time = {{ php_max_execution_time }}'
notify: restart php7-fpm

- name: enabling opcache
lineinfile: dest=/etc/php/7.0/fpm/php.ini
regexp='opcache.enable='
line='opcache.enable={{ php_opcache_enable }}'
insertafter="^[opcache]"
notify: restart php7-fpm

- name: opcache - changing revalidate frequency
lineinfile: dest=/etc/php/7.0/fpm/php.ini
regexp='opcache.revalidate_freq='
line='opcache.revalidate_freq={{ php_opcache_revalidate_freq }}'
insertafter="^[opcache]"
notify: restart php7-fpm

- name: opcache - changing validate timestamps
lineinfile: dest=/etc/php/7.0/fpm/php.ini
regexp='opcache.validate_timestamps='
line='opcache.validate_timestamps={{ php_opcache_opcache_validate_timestamps }}'
insertafter="^[opcache]"
notify: restart php7-fpm

- name: opcache - changing max accelerated files
lineinfile: dest=/etc/php/7.0/fpm/php.ini
regexp='opcache.max_accelerated_files='
line='opcache.validate_timestamps={{ php_opcache_max_accelerated_files }}'

This comment has been minimized.

Copy link
@riaf

riaf May 18, 2017

😮

insertafter="^[opcache]"
notify: restart php7-fpm

- name: opcache - memory consumption
lineinfile: dest=/etc/php/7.0/fpm/php.ini
regexp='opcache.memory_consumption='
line='opcache.memory_consumption={{ php_opcache_memory_consumption }}'
insertafter="^[opcache]"
notify: restart php7-fpm

- name: opcache - interned strings buffer
lineinfile: dest=/etc/php/7.0/fpm/php.ini
regexp='opcache.interned_strings_buffer='
line='opcache.interned_strings_buffer={{ php_opcache_interned_strings_buffer }}'
insertafter="^[opcache]"
notify: restart php7-fpm

- name: opcache - fast shutdown
lineinfile: dest=/etc/php/7.0/fpm/php.ini
regexp='opcache.fast_shutdown='
line='opcache.fast_shutdown={{ php_opcache_fast_shutdown }}'
insertafter="^[opcache]"
notify: restart php7-fpm

0 comments on commit 339b74e

Please sign in to comment.