Forge Home

phpfpm

pdk
Manages php-fpm daemon and pool configuration

Slashbunny

Slashbunny

46,936,557 downloads

248 latest version

4.7 quality score

Version information

  • 0.0.29 (latest)
  • 0.0.28 (deleted)
  • 0.0.27
  • 0.0.26
  • 0.0.25
  • 0.0.24
  • 0.0.23
  • 0.0.22
  • 0.0.21
  • 0.0.20
  • 0.0.19
  • 0.0.18
  • 0.0.17
  • 0.0.16
  • 0.0.15
  • 0.0.14
  • 0.0.13
  • 0.0.12
  • 0.0.11
  • 0.0.10
  • 0.0.9
  • 0.0.8
  • 0.0.7
  • 0.0.6
  • 0.0.5
  • 0.0.4
  • 0.0.3
  • 0.0.2
  • 0.0.1
released Oct 7th 2021
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • RedHat
    ,
    CentOS
    ,
    Ubuntu
    ,
    Debian
    ,
    ArchLinux
    ,
    AmazonAMI
    ,
    FreeBSD
    ,
    OpenBSD

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'Slashbunny-phpfpm', '0.0.29'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add Slashbunny-phpfpm
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install Slashbunny-phpfpm --version 0.0.29

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

Slashbunny/phpfpm — version 0.0.29 Oct 7th 2021

puppet-phpfpm

Build Status

Overview

This module manages the php-fpm daemon and pools only. Managing php, php extensions, pear, pecl, nginx, apache, etc are out of the scope of this module.

The module has been tested on Ubuntu, CentOS/RHEL, Archlinux and Amazon AMI.

  • phpfpm : Class that installs and configures php-fpm itself.
  • phpfpm::pool : Definition used to configure a fpm pool

Parameters

The name of the parameters mirror the name of the config variables in the php-fpm configuration file and the pool configuration file. However, be sure to replace periods with underscores, as puppet does not support parameter names with periods.

For example, if your pool configuration should set the pm.status_path option to "/mystatus", the pm.max_requests option to "900", and chroot to "/www", you would use the following parameters in your manifest:

phpfpm::pool { 'mypool':
    chroot          => '/www',
    pm_status_path  => '/mystatus',
    pm_max_requests => 900,
}

Please see the php-fpm configuration file comments for detailed explanations about what each option does.

Custom Parameters

$phpfpm::poold_purge : Delete all files in the pool.d folder that aren't managed by Puppet.

Examples

You must include the phpfpm class prior to configuring pools.

Install php-fpm with default options and a default pool called 'www' (packaging defaults on Ubuntu).

include phpfpm

Install php-fpm with non-default options:

class { 'phpfpm':
    process_max => 20,
    log_level   => 'warning',
    error_log   => '/var/log/phpfpm.log',
}

Install php-fpm and remove the default pool that ships with Ubuntu:

include phpfpm

phpfpm::pool { 'www':
    ensure => 'absent',
}

Do the same and add a pool named "main":

include phpfpm

phpfpm::pool { 'www':
    ensure => 'absent',
}

# TCP pool using 127.0.0.1, port 9000, upstream defaults
phpfpm::pool { 'main': }

Alternatively, use the purge flag to remove all non-managed pools, then create a pool named "main":

class { 'phpfpm':
    poold_purge => true,
}

# TCP pool using 127.0.0.1, port 9000, upstream defaults
phpfpm::pool { 'main': }

Use a custom template file, which you must provide, to generate the main FPM configuration file:

class { 'phpfpm':
    config_template_file => 'site/phpfpm/my-php-fpm.conf.erb',
}

Add a few custom pools with advanced options:

class { 'phpfpm':
    poold_purge => true,
}

# Pool running as a different user
phpfpm::pool { 'user_bob':
    listen => '127.0.0.1:9999',
    user   => 'bob',
    group  => 'users',
}

# Pool with dynamic process manager, TCP socket
phpfpm::pool { 'main':
    listen                 => '127.0.0.1:9000',
    listen_allowed_clients => '127.0.0.1',
    pm                     => 'dynamic',
    pm_max_children        => 10,
    pm_start_servers       => 4,
    pm_min_spare_servers   => 2,
    pm_max_spare_servers   => 6,
    pm_max_requests        => 500,
    pm_status_path         => '/status',
    ping_path              => '/ping',
    ping_response          => 'pong',
    env                    => {
        'ODBCINI' => '"/etc/odbc.ini"',
    },
    php_admin_flag         => {
        'expose_php' => 'Off',
    },
    php_admin_value        => {
        'max_execution_time' => '300',
    },
}

# Pool using a custom template file that you provide, rather than the stock template
phpfpm::pool { 'www':
    listen             => '127.0.0.1:9001',
    pool_template_file => 'site/phpfpm/mypool.conf.erb',
}

Notify the php-fpm daemon of your custom php configuration changes:

class { 'phpfpm':
    poold_purge => true,
}

phpfpm::pool { 'main': }

file { '/etc/php5/conf.d/pdo.ini':
    ensure  => 'present',
    content => template('web/pdo.ini.erb'),
    notify  => Class['phpfpm::service'],
}