Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 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, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >=2.7.20 <8.0.0
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'thias-php', '1.2.4'
Learn more about managing modules with a PuppetfileDocumentation
puppet-php
Overview
Install PHP packages and configure PHP INI files, for using PHP from the CLI, the Apache httpd module or FastCGI.
The module is very Red Hat Enterprise Linux focused, as the defaults try to change everything in ways which are typical for RHEL, but it also works on Debian based distributions (such as Ubuntu), and support for others should be easy to add.
php::cli
: Simple class to install PHP's Command Line Interfacephp::fpm::daemon
: Simple class to install PHP's FastCGI Process Managerphp::fpm::conf
: PHP FPM pool configuration definitionphp::ini
: Definition to create php.ini filesphp::mod_php5
: Simple class to install PHP's Apache httpd modulephp::module
: Definition to manage separately packaged PHP modulesphp::module::ini
: Definition to manage the ini files of separate modules
Examples
Create php.ini
files for different uses, but based on the same template :
php::ini { '/etc/php.ini':
display_errors => 'On',
memory_limit => '256M',
}
php::ini { '/etc/httpd/conf/php.ini':
mail_add_x_header => 'Off',
# For the parent directory
require => Package['httpd'],
}
Install the latest version of the PHP command line interface in your OS's package manager (e.g. Yum for RHEL):
include '::php::cli'
Install version 5.3.3 of the PHP command line interface :
class { 'php::cli': ensure => '5.3.3' }
Install the PHP Apache httpd module, using its own php configuration file (you will need mod_env in apache for this to work) :
class { 'php::mod_php5': inifile => '/etc/httpd/conf/php.ini' }
Install PHP modules which don't have any configuration :
php::module { [ 'ldap', 'mcrypt' ]: }
Configure PHP modules, which must be installed with php::module first :
php::module { [ 'pecl-apc', 'xml' ]: }
php::module::ini { 'pecl-apc':
settings => {
'apc.enabled' => '1',
'apc.shm_segments' => '1',
'apc.shm_size' => '64',
}
}
php::module::ini { 'xmlreader': pkgname => 'xml' }
php::module::ini { 'xmlwriter': ensure => 'absent' }
Install PHP FastCGI Process Manager with a single pool to be used with nginx. Note that we reuse the 'www' name to overwrite the example configuration :
include '::php::fpm::daemon'
php::fpm::conf { 'www':
listen => '127.0.0.1:9001',
user => 'nginx',
# For the user to exist
require => Package['nginx'],
}
Then from the nginx configuration :
# PHP FastCGI backend
upstream wwwbackend {
server 127.0.0.1:9001;
}
# Proxy PHP requests to the FastCGI backend
location ~ \.php$ {
# Don't bother PHP if the file doesn't exist, return the built in
# 404 page (this also avoids "No input file specified" error pages)
if (!-f $request_filename) { return 404; }
include /etc/nginx/fastcgi.conf;
fastcgi_pass wwwbackend;
}
# Try to send all non-existing files to the main /index.php
# (typically if you have a PHP framework requiring this)
location @indexphp {
if (-f $document_root/index.php) { rewrite .* /index.php last; }
}
try_files $uri @indexphp;
2020-06-25 - 1.2.4
- Add the ability to completely absent relevant php-fpm config values.
2019-09-17 - 1.2.3
- Add pcre_jit parameter, often needing to be disabled with PHP 7.3.
- Change expose_php default to Off, as it makes more sense.
- Default super obsole always_populate_raw_post_data to disabled.
- Move PID to main run dir, as sub-dir is no longer created by rpm.
2018-07-23 - 1.2.2
- Add more session related parameters (#83, @forgodssake).
2017-07-27 - 1.2.1
- Add session_entropy_length parameter.
2016-02-02 - 1.2.0
- Set owner for php-fpm log dir to undef to avoid ping-pong with rpm update.
- Update php_conf_dir to be compatible with Debian (#69, @heskymatic).
- Do not notify FPM if fpm daemon ensure is absent (#72, @kronos-pbrideau).
- Fix project URL (#75, @Vincent--).
- Add session_cookie_secure parameter (#71, @kronos-pbrideau).
- Add pcre_* parameters (#70, @crashcover).
- Add realpathcache* parameters (#63, @wwhurley).
- Include facts reporting php_version, php_majversion and php_minversion.
2015-04-01 - 1.1.1
- Fix php-fpm notification for php::module::ini when prefix was set.
2015-03-09 - 1.1.0
- Rebase php-fpm.conf and pool.conf with files from 5.5.22.
- Add syslog and rlimit related parameters to fpm.
- Fix security_limit_extensions being disabled even when set.
- Add session php_values to fpm pool template.
- Remove clear_env, no longer included in the original fpm pool file.
- Allow overriding fpm error_log (useful for syslog).
- Allow override of php_package_name in mod_php5 class (#35, @jeffsheltren).
- Notify fpm service on conf and module changes (#41, @khaefeli).
- Add cgi_fix_pathinfo parameter (#43, @mark0n).
- Rename fpm_package parameter to just package in fpm::conf for consistency.
- Allow fpm_service name override in fpm::conf (#49).
- Fix php.ini CLI default location for Debian (#50, @joshuaspence).
- Add always_populate_raw_post_data parameter (#58, @nomoresecrets).
- Default to full fpm restart on Debian OS family (#55).
2014-09-09 - 1.0.0
- Allow override of package names (#29, #30, #31, @jeffsheltren).
- Support prefix in module ini files, for recent Fedora/EL packages.
- Support $zend = true for module::ini, for PHP 5.6.
- Fix user_ini.cache_ttl which was always disabled (#39, @3flex).
2014-04-14 - 0.3.12
- Fix process_priority fpm parameter (#26, @Nyholm).
2014-04-01 - 0.3.11
- Add process_priority fpm parameter (#25, @Nyholm).
- Add process_max fpm parameter.
- Update the fpm templates with upstream changes.
- Add priority and process_idle_timeout parameters for fpm pools.
- Add clear_env and security_limit_extensions parameters for fpm pools.
- Allow specifying full package name for module::ini (#21, @jeffsheltren).
- Allow overriding cli_package_name (#20, @jeffsheltren).
2014-03-14 - 0.3.10
- Ensure /var/log/php-fpm directory exists (#24, @stevenyeung).
- Add support for listen_allowed_clients == 'any' (#22, @damonconway).
2014-01-20 - 0.3.9
- Update the el6 ini to add max_input_vars and max_file_uploads.
- Allow specifying php version as the 'ensure' parameter (#17, MasonM).
- Cosmetic updates and fixes in the manifests.
2013-12-20 - 0.3.8
- Fix the package name for APC on RHEL (Pan Luo).
- Fix the regsubst flag for 'pecl-' prefix removal (Pan Luo).
2013-10-01 - 0.3.7
- Manage the incorrectly named php-apc package under Debian (Jeroen Moors).
2013-09-30 - 0.3.6
- Enable using a custom template for php.ini (Nick Schuch).
2013-09-05 - 0.3.5
- Add upload_tmp_dir php.ini option support (Andy Shinn).
- Add soap related php.ini options support (Flavien Binet).
2013-08-30 - 0.3.3
- Use @varname syntax in fpm templates too.
- Fix php::module::ini when ensure is absent.
- Fix directory create for FPM (Erik Webb).
- Fix conf.d directory location for Debian (Erik Webb).
2013-06-13 - 0.3.2
- Add phar.readonly php.ini option support.
- Use undef for parameter defaults when not being used in php.ini.
- Remove the commented out defaults in php.ini for parameters being set.
2013-05-30 - 0.3.1
- Update mod_php support to also work with Debian OS family.
2013-05-30 - 0.3.0
- Add support for Debian OS family (Scott Lewis).
2013-04-19 - 0.2.5
- Stop ugly group/mode thing for php-fpm log, use $log_dir_mode instead.
- Use @varname syntax in templates to silence puppet 3.2 warnings.
2013-03-06 - 0.2.4
- Minor clean ups.
- Make /var/log/php-fpm group read-only when group is different from owner.
2012-12-18 - 0.2.3
- Add support for zend extensions.
2012-09-19 - 0.2.2
- Fix session_auto_start in the php.ini template.
- Fix ASP-style tags being processed as ERB in the php.ini template.
- Allow passing a file path for each fpm pool error_log.
- Add php_value/php_flag and php_admin_value/php_admin_flag in fpm pools.
2012-04-26 - 0.2.1
- Force sorting of module ini option hash to fix template with puppet 2.7+.
2012-04-26 - 0.2.0
- Clean up the module to match current puppetlabs guidelines.
- Fix all broken smoke tests.
- Major documentation update, adding more useful examples.
Copyright (C) 2011-2015 Matthias Saou Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.