From c57ed327e65be2ab6c29deac6f923937865c9a8a Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Sat, 16 Apr 2016 22:25:42 +0200 Subject: [PATCH 1/5] change ppa repo name --- defaults/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index a1809c4..9c5ac55 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -9,7 +9,9 @@ php_packages: - php7.0-fpm - php7.0-mysql - php7.0-gd + - php7.0-mbstring + - php7.0-mcrypt php_timezone: Europe/Warsaw php_upload_max_filesize: "20M" php_post_max_size: "20M" -php_memory_limit: "1024M" \ No newline at end of file +php_memory_limit: "1024M" From 4ead1f853c2a1e8cd571877fb13a09c78216fa22 Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Sat, 16 Apr 2016 22:29:13 +0200 Subject: [PATCH 2/5] add max execution time variable --- defaults/main.yml | 11 ++++++++++- tasks/php-fpm.yml | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 9c5ac55..5f1dd20 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,5 @@ --- -php_ppa: "ppa:ondrej/php-7.0" +php_ppa: "ppa:ondrej/php" php_packages: - php7.0-common - php7.0-cli @@ -15,3 +15,12 @@ php_timezone: Europe/Warsaw php_upload_max_filesize: "20M" php_post_max_size: "20M" php_memory_limit: "1024M" +php_max_execution_time: 60 + +php_opcache_enable: 1 +php_opcache_revalidate_freq: 2592000 +php_opcache_opcache_validate_timestamps: 1 +php_opcache_max_accelerated_files: 20000 +php_opcache_memory_consumption: 192 +php_opcache_interned_strings_buffer: 16 +php_opcache_fast_shutdown: 1 diff --git a/tasks/php-fpm.yml b/tasks/php-fpm.yml index ee9a0a9..051f5e1 100644 --- a/tasks/php-fpm.yml +++ b/tasks/php-fpm.yml @@ -78,4 +78,10 @@ lineinfile: dest=/etc/php/7.0/fpm/php.ini regexp='memory_limit(\s)?=' line='memory_limit = {{ php_memory_limit }}' - notify: restart php7-fpm \ No newline at end of file + notify: restart php7-fpm + +- name: Set max_execution_time + lineinfile: dest=/etc/php/7.0/fpm/php.ini + regexp='max_execution_time(\s)?=' + line='max_execution_time = {{ php_max_execution_time }}' + notify: restart php7-fpm From 339b74e4c472d8126593a6cd0aa78f9e6e588030 Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Sat, 16 Apr 2016 22:30:39 +0200 Subject: [PATCH 3/5] configure opcache for fpm and disable for cli --- tasks/configure.yml | 2 +- tasks/php-cli.yml | 6 +++--- tasks/php-fpm.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/tasks/configure.yml b/tasks/configure.yml index ae0ec96..6763f5c 100755 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -9,4 +9,4 @@ when: phpfpm.stat.exists - include: php-cli.yml - when: phpcli.stat.exists \ No newline at end of file + when: phpcli.stat.exists diff --git a/tasks/php-cli.yml b/tasks/php-cli.yml index 938fdcb..842b96e 100755 --- a/tasks/php-cli.yml +++ b/tasks/php-cli.yml @@ -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' diff --git a/tasks/php-fpm.yml b/tasks/php-fpm.yml index 051f5e1..e2a7290 100644 --- a/tasks/php-fpm.yml +++ b/tasks/php-fpm.yml @@ -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 }}' + 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 From 8504ced0650705f13963cc36c34459154c8a8e52 Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Sat, 16 Apr 2016 22:40:41 +0200 Subject: [PATCH 4/5] update readme --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b6189d1..ecee27b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ An Ansible role that installs and configure PHP 7 on Debian/Ubuntu servers. -Current PHP7 version: **7.0.0RC8** +Current PHP7 version: **7.0.5** ## Requirements @@ -12,7 +12,7 @@ None. Available variables are listed below, along with default values (see `defaults/main.yml`): - php_ppa: "ppa:ondrej/php-7.0" + php_ppa: "ppa:ondrej/php" php_packages: - php7.0-common - php7.0-cli @@ -22,9 +22,20 @@ Available variables are listed below, along with default values (see `defaults/m - php7.0-fpm - php7.0-mysql - php7.0-gd + - php7.0-mbstring + - php7.0-mcrypt php_upload_max_filesize: "20M" php_post_max_size: "20M" php_memory_limit: "1024M" + php_max_execution_time: 60 + + php_opcache_enable: 1 + php_opcache_revalidate_freq: 2592000 + php_opcache_opcache_validate_timestamps: 1 + php_opcache_max_accelerated_files: 20000 + php_opcache_memory_consumption: 192 + php_opcache_interned_strings_buffer: 16 + php_opcache_fast_shutdown: 1 ## Dependencies @@ -38,4 +49,4 @@ None. ## License -MIT \ No newline at end of file +MIT From 8add92c36da2ded37351cd4ba5a906485cde735e Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Sat, 16 Apr 2016 22:47:55 +0200 Subject: [PATCH 5/5] add timezone variable to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ecee27b..d835c03 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Available variables are listed below, along with default values (see `defaults/m - php7.0-gd - php7.0-mbstring - php7.0-mcrypt + php_timezone: Europe/Warsaw php_upload_max_filesize: "20M" php_post_max_size: "20M" php_memory_limit: "1024M"