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

Select Status


rackspace_apache_php (10) Versions 1.0.0

Installs/Configures rackspace_apache_php

cookbook 'rackspace_apache_php', '~> 1.0.0', :supermarket
cookbook 'rackspace_apache_php', '~> 1.0.0'
knife supermarket install rackspace_apache_php
knife supermarket download rackspace_apache_php
Quality 33%

Circle CI


A cookbook to provide a web server able to serve php pages with Apache and PHP fpm.
It relies on apache2 cookbook and php-fpm. Those cookbooks are pinned on well known working minor version to prevent breaking changes.
In addition (even if this is not a requirement), the cookbook will install php packages through PHP cookbook. Indeed most of the time you will need php::default in your role which will conflict with the php-fpm package if they are different.
You can disable the installation of php packages with node['rackspace_apache_php']['php_packages_install']['enable'].


NOTE: Support for PHP 5.4 was dropped in v1.0.0


Supported Platforms

  • Centos 6.7
  • Ubuntu 12.04
  • Ubuntu 14.04

Supported PHP versions

  • 5.5
  • 5.6


  • node['rackspace_apache_php']['php_version'] : Which PHP version to install, default to PHP 5.6
  • node['rackspace_apache_php']['php-fpm']['default_pool']['enable'] : Should it enable a default PHP-FPM pool which listens on a unix socket, defaults to 'true' (change it to false if you want to manage your own PHP-FPM pools)
  • node['rackspace_apache_php']['php_handler']['enable'] : Should it enable Apache PHP handler (applied in "conf.d", so it will be available in EVERY vhost, if you want to manage your own handler configuration, set this attribute to false)
  • node['rackspace_apache_php']['php_handler']['cookbook'] : Where to find the handler configuration , default to rackspace_apache_php cookbook
  • node['rackspace_apache_php']['php_handler']['template'] : Where to find the handler configuration , default to php-handler.conf.erb


Place a dependency on the rackspace_apache_php cookbook in your cookbook's metadata.rb

depends 'rackspace_apache_php'

Then, add rackspace_apache_php::default to your runlist

# myrecipe.rb
include_recipe 'rackspace_apache_php::default'


# roles/myrole.rb
name "myrole"
description "apache and php role"

You can change any of the apache2,php-fpm and php cookbook attributes to tune rackspace_apache_php configuration.
** However you should not change ** ['php-fpm']['package_name'],['php-fpm']['service_name'] or ['php']['packages'] (as they are part of this cookbook logic) without checking it works.

In scope

The goal of this library is to do the basic configuration to serve PHP pages through Apache. It will only configure apache2 and the default php handler, users are free to configure their vhost if they need anything more specific.

More in details it :

  • Installs and configure Apache2 web server
  • Installs and configure php-fpm
  • Installs and configure php
  • Configures Apache2 to serve php pages through php-fpm (in conf.d)
  • Gets the correct packages and change the configuration according to the php/apache version

Out of scope

Virtual Host are not managed by this cookbook, the configuration provided by this cookbook should not prevent users to extend php or php-fpm configuration.
As many features as possible should have a flag to enable/disable them, it will allow to enjoy some parts of the work done by this cookbook (get the correct packages by example) but still be able to configure your own php-fpm pools.


Apache and PHP 5.5

node.default['rackspace_apache_php']['php_version'] = '5.5'
include_recipe 'rackspace_apache_php::default'

Apache and PHP 5.6

include_recipe 'rackspace_apache_php::default'

Apache and PHP 5.6 without default PHP handler and default PHP-FPM pool

You will have to add your own Vhost to configure the handler, here is an example using a web_app resource and the apache_conf definition from the upstream apache2 cookbook to create a virtual host and the Apache configuration necessary to handle php requests (templates not provided). It also leverages the ['php-fpm']['pools'] attribute from the upstream php-fpm cookbook to create a custom defined php-fpm pool listening on a socket. Although not provided below, the templates for the apache_conf definition and the web_app resource should contain the necessary directives to pass requestes for php files to the php-fpm pool.

node.default['rackspace_apache_php']['php_handler']['enable'] = false
node.default['rackspace_apache_php']['php-fpm']['default_pool']['enable'] = false

# Create a php-fpm pool through the attribute exposed from upstream
node.default['php-fpm']['pools'] = {
  override: {
    enable: 'true',
    process_manager: 'dynamic',
    max_requests: 5000

include_recipe 'rackspace_apache_php::default'

# Create your own php-handler
apache_conf 'my-php-handler' do
  source 'my-php-handler.conf.erb'
  cookbook 'my-cookbook'
  enable true

# Create a virtual host to serve pages
web_app "my_site" do
  server_name node['hostname']
  server_aliases [node['fqdn'], ""]
  docroot "/srv/www/my_site"
  cookbook 'my-cookbook'
  php_socket '/var/run/php-fpm-override.sock'



  1. Fork the repository on Github
  2. Create a named feature branch (i.e. add-new-recipe)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request

License and Authors

Author:: Julien Berard (, Kostas Georgakopoulos (

Dependent cookbooks

apt >= 0.0.0
apache2 = 3.1.0
chef-sugar >= 0.0.0
php = 1.5.0
php-fpm = 0.7.4
yum-ius >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

rackspace_apache_php CHANGELOG


  • Release as v1.0.0
  • Dropped support for PHP 5.4
  • Updated unit tests


  • Unit test fixes
  • Support for CentOS 6.7 instead of 6.6


  • Fix for Rubocop tests
  • Improvements on integration tests


  • Added support for mod_proxy_fgi when using Apache 2.4


  • Corrections and clean up on tests


  • Added feature to enable/disable a default php-fpm pool
  • Disabled the default pool created by upstream php-fpm cookbook
  • Added testing for an 'override' recipe
  • Added 'supports' statements in metadata
  • Various improvements in unit and integration tests
  • Changed supported Centos from 6.5 to 6.6 in README


  • Pinned upstream apache2, php and php-fpm cookbooks to minor versions with '='
  • Enabled the default vhost from upstream apache2 only for integration tests


  • Removed unneeded 'libraries' directory


  • Added support for PHP in addition of PHP-fpm


  • First version

Collaborator Number Metric

1.0.0 failed this metric

Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric

1.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Foodcritic Metric

1.0.0 passed this metric

No Binaries Metric

1.0.0 passed this metric

Testing File Metric

1.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Version Tag Metric

1.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must include a tag that matches this cookbook version number