Version information
Start using this module
Add this module to your Puppetfile:
mod 'gousto-php', '1.0.0'
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;
}
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-2013 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.