Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


php5-fpm (19) Versions 0.3.4

Installs/Configures php5-fpm

cookbook 'php5-fpm', '= 0.3.4'
cookbook 'php5-fpm', '= 0.3.4', :supermarket
knife supermarket install php5-fpm
knife supermarket download php5-fpm
Quality -%

PHP5-FPM Cookbook

<br /> Adding pools can be done by way of LWRP provider or by modifying JSON directly in the attributes file or overriding the attributes through other methods, environments, roles, etc. Usage of the receipes beyond ::install is optional and not needed if using the LWRP provider.

When using the JSON option with recipes, if you do not wish to use a configuration value in the JSON attributes, you can simply set it to NOT_SET and it will not be included in the configuration file. Additionally, you can add more configuration values if they are missing, future proofing the template generation with JSON.

Supported Chef Versions

Chef 12 and below

Supported Platforms

Debian(6.x+), Ubuntu(10.04+) CentOS(6.x+), RedHat, Fedora(20+)

Tested Against

Debian 6.x and above Ubuntu 10.04 and above CenOS 6.x and above Fedora 20

Planned Improvements

0.4.0 - Auto Calculate Workers/Clients/ETC - Division of Resources

Required Cookbooks

hostupgrade <br /> <br /> <br />



<br /> <table> <tr> <th>Key</th> <th>Type</th> <th>Description</th> <th>Default</th> </tr> <tr> <td><tt>["php_fpm"]["install_php_modules"]</tt></td> <td>Boolean</td> <td>Install Additional PHP Modules</td> <td><tt>false</tt></td> </tr> <tr> <td><tt>["php_fpm"]["use_cookbook_repos"]</tt></td> <td>Boolean</td> <td>Use cookbook to install repos</td> <td><tt>true</tt></td> </tr> <tr> <td><tt>["php_fpm"]["run_update"]</tt></td> <td>Boolean</td> <td>Run hostupgrade::upgrade</td> <td><tt>true</tt></td> </tr> <tr> <td><tt>["php_fpm"]["create_users"]</tt></td> <td>Boolean</td> <td>Configure Users</td> <td><tt>true</tt></td> </tr> <tr> <td><tt>["php_fpm"]["users"]</tt></td> <td>JSON</td> <td>Users/Directories to Add</td> <td><tt>Attributes File</tt></td> </tr> <tr> <td><tt>["php_fpm"]["config"]</tt></td> <td>JSON</td> <td>PHP-FPM.conf Configuration Values</td> <td><tt>Attributes File</tt></td> </tr> <tr> <td><tt>["php_fpm"]["pools"]</tt></td> <td>JSON</td> <td>pool.conf Configuration Values</td> <td><tt>Attributes File</tt></td> </tr> <tr> <td><tt>["php_fpm"]["ubuntu1004_config"]</tt></td> <td>JSON</td> <td>PHP-FPM.conf Configuration Values Ubuntu 10.04 Only</td> <td><tt>Attributes File</tt></td> </tr> <tr> <td><tt>["php_fpm"]["ubuntu1004_pools"]</tt></td> <td>JSON</td> <td>pool.conf Configuration Values Ubuntu 10.04 Only</td> <td><tt>Attributes File</tt></td> </tr> </table> <br /> <br /> <br />



<br />


  • :create
  • :modify
  • :delete <br /> <br /> ### Attribute Parameters
#Overwrite for file replacement
attribute :overwrite, :kind_of => [ TrueClass, FalseClass ], :default => false

#Base Pool Configuration
attribute :pool_name, :name_attribute => true, :kind_of => String, :required => true
attribute :pool_user, :kind_of => String, :required => false, :default => 'www-data'
attribute :pool_group, :kind_of => String, :required => false, :default => 'www-data'
attribute :listen_address, :kind_of => String, :required => false, :default => '', :regex => Resolv::IPv4::Regex
attribute :listen_port, :kind_of => Integer, :required => false, :default => 9000
attribute :listen_allowed_clients, :kind_of => String, :required=> false, :default => nil
attribute :listen_owner, :kind_of => String, :required=> false, :default => nil
attribute :listen_group, :kind_of => String, :required=> false, :default => nil
attribute :listen_mode, :kind_of => String, :required=> false, :default => nil

#PM Configuration
attribute :pm, :kind_of => String, :required => false, :default => 'dynamic'
attribute :pm_max_children, :kind_of => Integer, :required => false, :default => 10
attribute :pm_start_servers, :kind_of => Integer, :required => false, :default => 4
attribute :pm_min_spare_servers, :kind_of => Integer, :required => false, :default => 2
attribute :pm_max_spare_servers, :kind_of => Integer, :required => false, :default => 6
attribute :pm_process_idle_timeout, :kind_of => String, :required => false, :default => '10s'
attribute :pm_max_requests, :kind_of => Integer, :required => false, :default => 0
attribute :pm_status_path, :kind_of => String, :required => false, :default => '/status'

#Ping Status
attribute :ping_path, :kind_of => String, :required => false, :default => '/ping'
attribute :ping_response, :kind_of => String, :required => false, :default => '/pong'

attribute :access_format, :kind_of => String, :required => false, :default => '%R - %u %t \"%m %r\" %s'
attribute :request_slowlog_timeout, :kind_of => Integer, :required => false, :default => 0
attribute :request_terminate_timeout, :kind_of => Integer, :required => false, :default => 0
attribute :access_log, :kind_of => String, :required => false, :default => nil
attribute :slow_log, :kind_of => String, :required => false, :default => nil

attribute :chdir, :kind_of => String, :required => false, :default => '/'
attribute :chroot, :kind_of => String, :required => false, :default => nil
attribute :catch_workers_output, :kind_of => String, :required => false, :equal_to => ['yes', 'no'], :default => 'no'
attribute :security_limit_extensions, :kind_of => String, :required => false, :default => '.php'
attribute :rlimit_files, :kind_of => Integer, :required => false, :default => nil
attribute :rlimit_core, :kind_of => Integer, :required => false, :default => nil

attribute :php_ini_flags, :kind_of => Hash, :required => false, :default => nil
attribute :php_ini_values, :kind_of => Hash, :required => false, :default => nil
attribute :php_ini_admin_flags, :kind_of => Hash, :required => false, :default => nil
attribute :php_ini_admin_values, :kind_of => Hash, :required => false, :default => nil

#ENV Variables
attribute :env_variables, :kind_of => Hash, :required => false, :default => nil

<br /> <br />


php5_fpm_pool "example" do
    pool_user "www-data"
    pool_group "www-data"
    listen_address ""
    listen_port 8000
    listen_allowed_clients ""
    listen_owner "nobody"
    listen_group "nobody"
    listen_mode "0666"
    php_ini_flags (
                    { "display_errors" => "off", "log_errors" => "on"}
    php_ini_values (
                      { "sendmail_path" => "/usr/sbin/sendmail -t -i -f", "memory_limit" => "32M"}
    overwrite true
    action :create
    notifies :restart, "service[#{node["php_fpm"]["package"]}]", :delayed
php5_fpm_pool "example" do
    pool_user "fpm_user"
    pool_group "fpm_group"
    listen_allowed_clients ""
    pm_max_children 30
    pm_start_servers 10
    pm_min_spare_servers 5
    pm_max_spare_servers 10
    pm_process_idle_timeout "30s"
    pm_max_requests 1000
    pm_status_path "/mystatus"
    ping_path "/myping"
    ping_response "/myresponse"
    php_ini_flags (
                      { "display_errors" => "on", "log_errors" => "off"}
    php_ini_values (
                       { "sendmail_path" => "/usr/sbin/sendmail -t -i -f", "memory_limit" => "16M"}
    action :modify
    notifies :restart, "service[#{node["php_fpm"]["packag"]}]", :delayed

<br /> <br /> <br />

Recipe Usage

php-fpm::install (required)

Install PHP5-FPM. Include php5-fpm::install in your node's run_list:

  "run_list": [

php5-fpm::create_user (optional)

This will create users and directories for use with pools. Include php5-fpm::create_user in your node's run_list:

  "run_list": [

php5-fpm::configure_pools (optional)

This will create pools based on JSON attributes. Not needed if you are using the LWRP provider. Include php5-fpm::configure_pools in your node's run_list:

  "run_list": [

php5-fpm::example_pool (optional)

Example on how to use the LWRP provider. This is not a required recipe but include php5-fpm::example_pool in your node's run_list if you wish to try the example:

  "run_list": [

<br /> <br /> <br />

License and Authors

Authors: Brian Stajkowski

Copyright 2014 Brian Stajkowski

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

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.

Dependent cookbooks

hostupgrade >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

php5-fpm CHANGELOG


  • stajkowski - Adjust changelog order for updates from Chef Supermarket. Moved host update and upgrade actions to hostupgrade cookbook and included recipe, added berksfile location, and updated metadata. Added node["php_fpm"]["run_update"] to state if hostupgrade recipe should run. Added node["php_fpm"]["use_cookbok_repos"] to control if you want the cookbook to install the correct repos for installing php5-fpm on debian, centos, and ubuntu earlier versions. Removed node["php_fpm"]["update_system"] and node["php_fpm"]["upgrade_system"], so by setting php_fpm/run_update and php_fpm/use_cookbook_repos to false, you can control your own operation of installing repos and updating the system if need be. Or, leave them to default if you wish to have php5-fpm cookbook control this operation. **Keep in mind, the hostupgrade cookbook is set by default to run only on the first run and not every time chef-client runs, set node["host_upgrade"]["first_time_only"] to false to run every time. *Attribute node["php_fpm"]["install_php_modules"] is now set to false by default as this is optional. **Recipe configure_fpm.rb has been removed. This is now part of the install recipe; now, as a minimum, you only need to run install recipe. - - -


  • stajkowski - Chef 12 Supported Now. Adjusted update, upgrade and install_php_modules for boolean values. Add attributes for Chef Server. Adjusted README to indicate configure_fpm a required recipe. Fixed Serverspec OS detection for v2. Fixed CHEF 12 unsupported methods for calling attributes.


  • stajkowski - Added PHP Overrides and Environment variables to LWRP. Revised documentation and updated README.


  • rodriguez - Adjust installation script so that it doesn't restart php-fpm everytime chef-client is run.


  • stajkowski - Created LWRP for pool create, modify and delete. LWRP example receipe shows the potential usage. The documentation outlines all available attributes. Tested and verified.


  • stajkowski - Updated install receipe to fix the update/upgrade operation. Now allows for the option and fully functional. Added and tested against more platforms, check .kitchen.yml. Fixed 14.04 bug for service provider, will include this until the bug is fixed. Added support for Debian 6.x and above and added support for Ubuntu 10.04 and above, this has a seperate JSON configuration due to recent configuration settings not supported in these earlier versions.


  • stajkowski - Tested Fedora 20 support. Generated Test Kitchen files and preparing for kitchen scripts.


  • stajkowski - Added Redhat and CentOS support. Allow for the option to update package repos on the system.


  • stajkowski - Rework attribute structure, prepare for additional platforms.


  • stajkowski - Intial Commit/Base Recipes.

No quality metric results found