Defined Type: php::ini

Defined in:
puppet/modules/php/manifests/ini.pp

Overview

Define: php::ini

This resource type represents a set of PHP configuration directives that are managed via an ini file in /etc/php/<version>/conf.d. PHP interprets these files as extensions of the main php.ini configuration file. For more information, see <wiki.debian.org/PHP#Configuration_layout> and <php.net/manual/en/configuration.file.php>.

Parameters

settings

A hash or array of PHP configuration directives. For a list of core php.ini directives, see <www.php.net/manual/en/ini.php>.

Examples

Example showing settings as a hash:

 php::ini { 'apc':
   settings => {
     'apc.enabled'          => 1,
     'apc.cache_by_default' => 1
   },
}

Example showing settings as an array:

 php::ini { 'apc':
   settings => [
    'apc.enabled = 1',
    'apc.cache_by_default = 1'
   ],
}

Parameters:

  • settings (Any)


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'puppet/modules/php/manifests/ini.pp', line 35

define php::ini( $settings ) {
    include ::php
    include ::apache

    # Puppet-managed .ini file names start with an underscore
    # so they can be distinguished from package-provided files.
    $basename = inline_template('_<%= @title.gsub(/\W/, "-").downcase %>')
    $conffile = "/etc/php/7.4/mods-available/${basename}.ini"

    file { $conffile:
        content => template('php/conffile.ini.erb'),
        require => Class['php::package'],
        notify  => Service['apache2'],
    }

    exec { "/usr/sbin/phpenmod -s ALL ${basename}":
        refreshonly => true,
        subscribe   => File[$conffile],
    }
}