Forge Home

php

PHP module

9,463 downloads

9,463 latest version

4.1 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 1.0.0 (latest)
released Feb 9th 2015

Start using this module

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

Add this module to your Puppetfile:

mod 'gousto-php', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gousto-php
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gousto-php --version 1.0.0

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

gousto/php — version 1.0.0 Feb 9th 2015

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 Interface
  • php::fpm::daemon : Simple class to install PHP's FastCGI Process Manager
  • php::fpm::conf : PHP FPM pool configuration definition
  • php::ini : Definition to create php.ini files
  • php::mod_php5 : Simple class to install PHP's Apache httpd module
  • php::module : Definition to manage separately packaged PHP modules
  • php::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;
}