{%- for version in pillar_php_version %} | {%- for version in pillar_php_version %} | ||||
{%- set first_version = pillar_php_version[0]|string %} | {%- set first_version = pillar_php_version[0]|string %} | ||||
{%- set ini = php.lookup.cli.ini|replace(first_version, version) %} | {%- set ini = php.lookup.cli.ini|replace(first_version, version) %} | ||||
{%- if version in php.cli.ini %} | |||||
{%- set settings_versioned = {} %} | |||||
{%- for key, value in settings.items() %} | |||||
{%- do settings_versioned.update({key: value.copy()}) %} | |||||
{%- endfor %} | |||||
{%- for key, value in php.cli.ini[version].items() %} | |||||
{%- if settings_versioned[key] is defined %} | |||||
{%- do settings_versioned[key].update(value) %} | |||||
{%- else %} | |||||
{%- do settings_versioned.update({key: value}) %} | |||||
{%- endif %} | |||||
{%- endfor %} | |||||
{%- endif %} | |||||
php_cli_ini_{{ version }}: | php_cli_ini_{{ version }}: | ||||
{{ php_ini(ini, | {{ php_ini(ini, | ||||
'php_cli_ini_' ~ version, | 'php_cli_ini_' ~ version, | ||||
php.cli.ini.opts, | php.cli.ini.opts, | ||||
settings | |||||
settings_versioned | default(settings) | |||||
) }} | ) }} | ||||
{%- endfor %} | {%- endfor %} | ||||
{%- else %} | {%- else %} |
{%- set conf = php.lookup.fpm.conf|replace(first_version, version) %} | {%- set conf = php.lookup.fpm.conf|replace(first_version, version) %} | ||||
{%- set pools = php.lookup.fpm.pools|replace(first_version, version) %} | {%- set pools = php.lookup.fpm.pools|replace(first_version, version) %} | ||||
{%- if version in php.fpm.config.ini %} | |||||
{%- set ini_settings_versioned = {} %} | |||||
{%- for key, value in ini_settings.items() %} | |||||
{%- do ini_settings_versioned.update({key: value.copy()}) %} | |||||
{%- endfor %} | |||||
{%- for key, value in php.fpm.config.ini[version].items() %} | |||||
{%- if ini_settings_versioned[key] is defined %} | |||||
{%- do ini_settings_versioned[key].update(value) %} | |||||
{%- else %} | |||||
{%- do ini_settings_versioned.update({key: value}) %} | |||||
{%- endif %} | |||||
{%- endfor %} | |||||
{%- endif %} | |||||
{%- for key, value in conf_settings.items() %} | {%- for key, value in conf_settings.items() %} | ||||
{%- if value is string %} | {%- if value is string %} | ||||
{%- do conf_settings.update({key: value.replace(first_version, version)}) %} | {%- do conf_settings.update({key: value.replace(first_version, version)}) %} | ||||
{%- endif %} | {%- endif %} | ||||
{%- endfor %} | {%- endfor %} | ||||
{%- do conf_settings.global.update({'pid': '/var/run/php' + version + '-fpm.pid' }) %} | |||||
{%- do conf_settings.global.update({'pid': '/run/php/php' + version + '-fpm.pid' }) %} | |||||
{%- do conf_settings.global.update({'error_log': '/var/log/php' + version + '-fpm.log' }) %} | {%- do conf_settings.global.update({'error_log': '/var/log/php' + version + '-fpm.log' }) %} | ||||
php_fpm_ini_config_{{ version }}: | php_fpm_ini_config_{{ version }}: | ||||
{{ php_ini(ini, | {{ php_ini(ini, | ||||
'php_fpm_ini_config_' ~ version, | 'php_fpm_ini_config_' ~ version, | ||||
php.fpm.config.ini.opts, | php.fpm.config.ini.opts, | ||||
ini_settings | |||||
ini_settings_versioned | default(ini_settings) | |||||
) }} | ) }} | ||||
php_fpm_conf_config_{{ version }}: | php_fpm_conf_config_{{ version }}: |
engine: 'Off' | engine: 'Off' | ||||
extension_dir: '/usr/lib/php/modules/' | extension_dir: '/usr/lib/php/modules/' | ||||
extension: [pdo_mysql.so, iconv.so, openssl.so] | extension: [pdo_mysql.so, iconv.so, openssl.so] | ||||
# if a list of versions is set in php:version, each version | |||||
# may have different settings | |||||
# '7.2': | |||||
# PHP: | |||||
# short_open_tag: 'On' | |||||
# options to manage the php-fpm conf file | # options to manage the php-fpm conf file | ||||
conf: | conf: | ||||
settings: | settings: | ||||
PHP: | PHP: | ||||
engine: 'Off' | engine: 'Off' | ||||
# if a list of versions is set in php:version, each version | |||||
# may have different settings | |||||
# '7.2': | |||||
# PHP: | |||||
# short_open_tag: 'On' | |||||
# php-xcache settings | # php-xcache settings | ||||
xcache: | xcache: |