diff --git a/roles/nginx/php-fpm/defaults/main.yml b/roles/nginx/php-fpm/defaults/main.yml index a2ee24f..78cae02 100644 --- a/roles/nginx/php-fpm/defaults/main.yml +++ b/roles/nginx/php-fpm/defaults/main.yml @@ -5,6 +5,7 @@ php_version: "{{ (ansible_distribution_major_version >= '10') | ternary('7.3', ' phpfpm_package: "php{{ php_version }}-fpm" phpfpm_configuration_directory: "/etc/php/{{ php_version }}/fpm" phpfpm_configuration: "{{ phpfpm_configuration_directory }}/php-fpm.conf" +phpfpm_php_ini: "{{ phpfpm_configuration_directory }}/php.ini" phpfpm_pools_directory: "{{ phpfpm_configuration_directory }}/pool.d" phpfpm_sockets_directory: "/var/run/php-pools" diff --git a/roles/nginx/php-fpm/tasks/main.yml b/roles/nginx/php-fpm/tasks/main.yml index f80164d..7c438ac 100644 --- a/roles/nginx/php-fpm/tasks/main.yml +++ b/roles/nginx/php-fpm/tasks/main.yml @@ -19,6 +19,18 @@ group: root mode: "u=rwx,g=rx,o=rx" -# -#- name: Configure php-fpm -# notify: "reload php-fpm" +- name: Configure php-fpm + lineinfile: + path: "{{ phpfpm_php_ini }}" + state: present + regexp: "^;?{{ item.key | regex_escape() }}=" + line: "{{ item.key }}={{ item.value }}" + with_dict: + opcache.enable: 1 + opcache.enable_cli: 1 + opcache.memory_consumption: 128 + opcache.interned_strings_buffer: 8 + opcache.max_accelerated_files: 10000 + opcache.revalidate_freq: 1 + opcache.save_comments: 1 + notify: reload php-fpm