Version information
This version is compatible with:
- Puppet Enterprise 3.x
- Puppet 3.x
- FreeBSD, , OpenSUSE , , , ,
This module has been deprecated by its author since Nov 13th 2018.
The reason given was: This module has been adopted by Vox Pupuli.
The author has suggested puppet-php as its replacement.
Start using this module
Documentation
mayflower/php Puppet Module
mayflower/php is a Puppet module for managing PHP with a strong focus
on php-fpm. We strive to support all recent versions of Debian, Ubuntu,
RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache with mod_php
is not supported.
This originally was a fork of jippi/puppet-php (nodes-php on Puppet Forge) but has since been rewritten in large parts.
Usage
The module aims to use sane defaults for the supported architectures. You must use hiera to configure most aspects of this module in a simple way.
The recommended way is to include the php
main class in your manifests:
include ::php
You can configure the module through hiera. Here are the defaults for some parameters as you would specify them in hiera:
php::ensure: latest
php::manage_repos: true
php::fpm: true
php::dev: true
php::composer: true
php::pear: true
php::phpunit: false
php::fpm::config::log_level: notice
php::composer::auto_update: true
There are more configuration options available. Please refer to the auto-generated documention at http://php.puppet.mayflower.de/.
Defining php.ini
settings
PHP configuration parmaters in php.ini
files can be defined as parameter
settings
on the php
, php::fpm
and php::cli
classes or
php::extension
resources for each component independently.
These settings are written into their respective php.ini
file. Global
settings in php::settings
are merged with the settings of all components.
Please note that settings of extensions are always independent.
In the following example the timezone will be set in the PHP cli application and all php-fpm pools.
php::settings:
Date/date.timezone: Europe/Berlin
php::cli::settings:
PHP/memory_limit: 512M
php::fpm::settings:
PHP/short_open_tag: 'On'
Installing extensions
Extensions can be installed and configured by defining the hash
php::extensions
in hiera. They are activated for all activated SAPIs.
php::extensions:
json: {}
mysql: {}
memcached:
provider: pecl
header_packages:
- libmemcached-dev
apc:
package_prefix: php-
settings:
apc.stat: 1
apc.stat_ctime: 1
See the documentation
of the php::extension
resource for all available parmeters and default
values.
Defining php-fpm pools
If different php-fpm pools are required, you can use php::fpm::pool
resources. Use the parameter $pools
from the class php::fpm
to define
php::fpm::pool
resources as a hash from hiera.
If not defined in your hiera data, a single pool called www
will be
configured by default:
php::fpm::pools:
www:
listen: 127.0.0.1:9000
For an overview of all possible parameters for php::fpm::pool
resources
please see its documention.
Notes
Debian squeeze & Ubuntu precise come with PHP 5.3
On Debian-based systems, we use php5enmod
to enable extension-specific
configuration. This script is only present in php5
packages beginning with
version 5.4. Furthermore, PHP 5.3 is not supported by upstream anymore.
We strongly suggest you use a recent PHP version, even if you're using an
older though still supported distribution release. Our default is to have
php::manage_repos
enabled to add apt sources for
Dotdeb on Debian and
ppa:ondrej/php5 on
Ubuntu with packages for the current stable PHP version closely tracking
upstream.
Apache support
Apache with mod_php
is not supported by this module. Please use
puppetlabs/apache instead.
We prefer using php-fpm. You can find an example Apache vhost in
manifests/apache_vhost.pp
that shows you how to use mod_proxy_fcgi
to
connect to php-fpm.
FreeBSD support
On FreeBSD systems we purge the system-wide extensions.ini
in favour of
per-module configuration files.
Please also note that support for Composer and PHPUnit on FreeBSD is untested and thus likely incomplete.
Bugs & New Features
If you happen to stumble upon a bug, please feel free to create a pull request with a fix (optionally with a test), and a description of the bug and how it was resolved.
Or if you're not into coding, simply create an issue adding steps to let us reproduce the bug and we will happily fix it.
If you have a good idea for a feature or how to improve this module in general, please create an issue to discuss it. We are very open to feedback. Pull requests are always welcome.
We hate orphaned and unmaintained Puppet modules as much as you do and therefore promise that we will continue to maintain this module and keep response times to issues short. If we happen to lose interest, we will write a big fat warning into this README to let you know.
License
The project is released under the permissive MIT license.
The source can be found at github.com/mayflower/puppet-php.
This Puppet module is being actively maintained by some fellow puppeteers at Mayflower GmbH.
Changelog
3.3.0
php::extension
resources:- New boolean parameter
settings_prefix
to automatically prefix all settings keys with the extensions names. Defaults to false to ensurre the current behaviour. - New string parameter
so_name
to set the DSO name of an extension if it doesn't match the package name. - New string parameter
php_api_version
to set a custom api version. If notundef
, theso_name
is prefixed with the full module path in the ini file. Defaults toundef
.
- New boolean parameter
- The default of the parameter
listen_allowed_clients
ofphp::fpm::pool
resources is nowundef
instead of'127.0.0.1'
. This way it is more intuitive to change the default tcp listening socket at127.0.0.1:9000
to a unix socket by only setting thelisten
parameter instead of additionally needing to unsetlisten_allowed_clients
. This has no security implications. - New parameters for the
php::fpm::config
class:error_log
syslog_facility
syslog_ident
systemd_interval
- A bug that prevented merging the global
php::settings
parameter into SAPI configs forphp::cli
andphp::fpm
was fixed. - The dotdeb repos are now only installed for Debian wheezy as Debian jessie has a sufficiently recent PHP version.
3.2.2
- Fix a typo in hiera keys
php::settings
&php::fpm::settings
(#83)
3.2.1
- Fixed default
yum_repo
key inphp::repo::redhat
- On Ubuntu precise we now use the ondrej/php5-oldstable ppa. This can be
manually enabled with by setting
$php::repo::ubuntu::oldstable
totrue
. $php::ensure
now defaults topresent
instead oflatest
. Though, strictly speaking, this represents a functional change, we consider this to be a bugfix because automatic updates should be enabled explicitely.$php::ensure
is not anymore passed tophp::extension
resources as default ensure parameter because this doesn't make sense.
3.2.0
- Support for FreeBSD added by Frank Wall
- RedHat now uses remi-php56 yum repo by default
- The resource
php::fpm::pool
is now public, you can use it in your manifests without using$php::fpm::pools
- We now have autogenerated documentation using
puppetlabs/strings
3.1.0
- New parameter
pool_purge
forphp::extension
to remove files not managed by puppet from the pool directory. - The
pecl_source
parameter forphp::extension
was renamend tosource
because it is also useful for PEAR extensions.pecl_source
can still be used but is deprecated and will be removed in the next major release. - Parameters referring to time in
php::fpm::config
can now be specified with units (i.e.'60s'
,'1d'
):emergency_restart_threshold
emergency_restart_interval
process_control_timeout
- The PEAR version is not independant of
$php::ensure
and can be configured with$php::pear_ensure
- Give special thanks to the contributors of this release:
- Petr Sedlacek
- Sherlan Moriah
3.0.1
- Fix typo in package suffix for php-fpm on RHEL in params.pp
3.0.0
- Removes
$php::fpm::pool::error_log
. Use thephp_admin_flag
andphp_admin_value
parameters to set the php settingslog_errors
anderror_log
instead. - Removes support for PHP 5.3 on Debian-based systems. See the notes in the README for more information.
- Removes the
php_version
fact which had only worked on the later puppet runs. - Moves CLI-package handling to
php::packages
- Allows changing the package prefix via
php::package_prefix
. - Moves FPM-package handling from
php::fpm::package
tophp::fpm
- Changes
php::packages
, so thatphp::packages::packages
becomesphp::packages::names
and are installed andphp::packages::names_to_prefix
are installed prefixed byphp::package_prefix
. - PHPUnit is now installed as phar in the same way composer is installed, causing all parameters to change
- The
php::extension
resource has a new parameter:zend
. If set to true, exenstions that were installed with pecl are loaded withzend_extension
.
2.0.4
- Style fixes all over the place
- Module dependencies are now bound to the current major version
2.0.3
- Some issues & bugs with extensions were fixed
- If you set the
provider
parameter of an extension to"none"
, no extension packages will be installed - The EPEL yum repo has been added for RedHat systems
2.0.2
- Adds support for
header_packages
on all extensions - Adds
install_options
to pear package provider
2.0.1
- This is a pure bug fix release
- Fix for CVE 2014-0185 (https://bugs.php.net/bug.php?id=67060)
2.0.0
- Remove augeas and switch to puppetlabs/inifile for configs
- Old:
settings => [‘set PHP/short_open_tag On‘]
- New:
settings => {‘PHP/short_open_tag’ => ‘On‘}
- Old:
- Settings parmeter cleanups
- The parameter
config
ofphp::extension
resources is now calledsettings
- The parameters
user
andgroup
ofphp::fpm
have been moved tophp::fpm::config
- New parameter
php::settings
for global settings (i.e. CLI & FPM)
- The parameter
- New parameter
php::cli
to disable CLI if supported
1.1.2
- SLES: PHP 5.5 will now be installed
- Pecl extensions now autoload the .so based on $name instead of $title
1.1.1
- some nasty bugs with the pecl php::extension provider were fixed
- php::extension now has a new pecl_source parameter for specifying custom source channels for the pecl provider
1.1.0
- add phpunit to main class
- fix variable access for augeas
1.0.2
- use correct suse apache service name
- fix anchoring of augeas
1.0.1
- fixes #9 undefined pool_base_dir
1.0.0
Initial release
Dependencies
- puppetlabs/stdlib (>= 4.2.0 < 5.0.0)
- puppetlabs/apt (>= 1.0.0 < 3.0.0)
- puppetlabs/inifile (1.x)
- darin/zypprepo (1.x)
- example42/yum (2.x)