Skip to content

Commit

Permalink
feat(global) Add php.ini global settings
Browse files Browse the repository at this point in the history
  • Loading branch information
minorOffense authored and fpletz committed Mar 23, 2016
1 parent 5e75170 commit 2659ae2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
33 changes: 33 additions & 0 deletions manifests/global.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Install and configure mod_php for fpm
#
# === Parameters
#
# [*inifile*]
# Absolute path to the global php.ini file. Defaults
# to the OS specific default location as defined in params.
# [*settings*]
# Hash of settings to apply to the global php.ini file.
# Defaults to OS specific defaults (i.e. add nothing)
#

#
class php::global(
$inifile = $::php::params::config_root_inifile,
$settings = {}
) inherits ::php::params {

if $caller_module_name != $module_name {
warning('php::global is private')
}

validate_absolute_path($inifile)
validate_hash($settings)

# No deep merging required since the settings we have are the global settings.
$real_settings = $settings

::php::config { 'global':
file => $inifile,
config => $real_settings,
}
}
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@
} ->
anchor { 'php::end': }

# Configure global PHP settings in php.ini
Anchor['php::begin'] ->
class {'::php::global':
settings => $real_settings,
} ->
Anchor['php::end']

if $fpm {
Anchor['php::begin'] ->
class { '::php::fpm':
Expand Down
8 changes: 6 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'Debian': {
$config_root = pick($cfg_root, '/etc/php5')
$config_root_ini = "${config_root}/mods-available"
$config_root_inifile = "${config_root}/php.ini"
$common_package_names = []
$common_package_suffixes = ['cli', 'common']
$cli_inifile = "${config_root}/cli/php.ini"
Expand Down Expand Up @@ -63,6 +64,7 @@
'Suse': {
$config_root = pick($cfg_root, '/etc/php5')
$config_root_ini = "${config_root}/conf.d"
$config_root_inifile = "${config_root}/php.ini"
$common_package_names = ['php5']
$common_package_suffixes = []
$cli_inifile = "${config_root}/cli/php.ini"
Expand Down Expand Up @@ -95,14 +97,15 @@
}
'RedHat': {
$config_root_ini = '/etc/php.d'
$config_root_inifile = '/etc/php.ini'
$common_package_names = []
$common_package_suffixes = ['cli', 'common']
$cli_inifile = '/etc/php-cli.ini'
$dev_package_suffix = 'devel'
$fpm_pid_file = '/var/run/php-fpm/php-fpm.pid'
$fpm_config_file = '/etc/php-fpm.conf'
$fpm_error_log = '/var/log/php-fpm/error.log'
$fpm_inifile = '/etc/php.ini'
$fpm_inifile = '/etc/php-fpm.ini'
$fpm_package_suffix = 'fpm'
$fpm_pool_dir = '/etc/php-fpm.d'
$fpm_service_name = 'php-fpm'
Expand All @@ -118,6 +121,7 @@
'FreeBSD': {
$config_root = pick($cfg_root, '/usr/local/etc')
$config_root_ini = "${config_root}/php"
$config_root_inifile = "${config_root}/php.ini"
# No common packages, because the required PHP base package will be
# pulled in as a dependency. This preserves the ability to choose
# any available PHP version by setting the 'package_prefix' parameter.
Expand All @@ -128,7 +132,7 @@
$fpm_pid_file = '/var/run/php-fpm.pid'
$fpm_config_file = "${config_root}/php-fpm.conf"
$fpm_error_log = '/var/log/php-fpm.log'
$fpm_inifile = "${config_root}/php.ini"
$fpm_inifile = "${config_root}/php-fpm.ini"
$fpm_package_suffix = undef
$fpm_pool_dir = "${config_root}/php-fpm.d"
$fpm_service_name = 'php-fpm'
Expand Down

0 comments on commit 2659ae2

Please sign in to comment.