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


php (93) Versions 1.2.6

Installs and maintains php and php modules

cookbook 'php', '= 1.2.6', :supermarket
cookbook 'php', '= 1.2.6'
knife supermarket install php
knife supermarket download php
Quality -%

php Cookbook

Installs and configures PHP 5.3 and the PEAR package management system. Also includes LWRPs for managing PEAR (and PECL) packages along with PECL channels.



  • Debian, Ubuntu
  • CentOS, Red Hat, Fedora, Amazon Linux


  • build-essential
  • xml
  • mysql

These cookbooks are only used when building PHP from source.


  • node['php']['install_method'] = method to install php with, default package.
  • node['php']['directives'] = Hash of directives and values to append to php.ini, default {}.

The file also contains the following attribute types:

  • platform specific locations and settings.
  • source installation settings


This cookbook includes LWRPs for managing:

  • PEAR channels
  • PEAR/PECL packages


PEAR Channels are alternative sources for PEAR packages. This LWRP provides and easy way to manage these channels.


  • :discover: Initialize a channel from its server.
  • :add: Add a channel to the channel list, usually only used to add private channels. Public channels are usually added using the :discover action
  • :update: Update an existing channel
  • :remove: Remove a channel from the List

Attribute Parameters

  • channel_name: name attribute. The name of the channel to discover
  • channel_xml: the channel.xml file of the channel you are adding


# discover the horde channel
php_pear_channel "" do
  action :discover

# download xml then add the symfony channel
remote_file "#{Chef::Config[:file_cache_path]}/symfony-channel.xml" do
  source ""
  mode 0644
php_pear_channel "symfony" do
  channel_xml "#{Chef::Config[:file_cache_path]}/symfony-channel.xml"
  action :add

# update the main pear channel
php_pear_channel '' do
  action :update

# update the main pecl channel
php_pear_channel '' do
  action :update


PEAR is a framework and distribution system for reusable PHP components. PECL is a repository for PHP Extensions. PECL contains C extensions for compiling into PHP. As C programs, PECL extensions run more efficiently than PEAR packages. PEARs and PECLs use the same packaging and distribution system. As such this LWRP is clever enough to abstract away the small differences and can be used for managing either. This LWRP also creates the proper module .ini file for each PECL extension at the correct location for each supported platform.


  • :install: Install a pear package - if version is provided, install that specific version
  • :upgrade: Upgrade a pear package - if version is provided, upgrade to that specific version
  • :remove: Remove a pear package
  • :purge: Purge a pear package (this usually entails removing configuration files as well as the package itself). With pear packages this behaves the same as :remove

Attribute Parameters

  • package_name: name attribute. The name of the pear package to install
  • version: the version of the pear package to install/upgrade. If no version is given latest is assumed.
  • preferred_state: PEAR by default installs stable packages only, this allows you to install pear packages in a devel, alpha or beta state
  • directives: extra extension directives (settings) for a pecl. on most platforms these usually get rendered into the extension's .ini file
  • zend_extensions: extension filenames which should be loaded with zend_extension.
  • options: Add additional options to the underlying pear package command


# upgrade a pear
php_pear "XML_RPC" do
  action :upgrade

# install a specific version
php_pear "XML_RPC" do
  version "1.5.4"
  action :install

# install the mongodb pecl
php_pear "mongo" do
  action :install

# install the xdebug pecl
php_pear "xdebug" do
  # Specify that must be loaded as a zend extension
  zend_extensions ['']
  action :install

# install apc pecl with directives
php_pear "apc" do
  action :install
  directives(:shm_size => 128, :enable_cli => 1)

# install the beta version of Horde_Url
# from the horde channel
hc = php_pear_channel "" do
  action :discover
php_pear "Horde_Url" do
  preferred_state "beta"
  channel hc.channel_name
  action :install

# install the YAML pear from the symfony project
sc = php_pear_channel "" do
  action :discover
php_pear "YAML" do
  channel sc.channel_name
  action :install



Include the default recipe in a run list, to get php. By default php is installed from packages but this can be changed by using the install_method attribute.


This recipe installs PHP from packages.


This recipe installs PHP from source.

Deprecated Recipes

The following recipes are deprecated and will be removed from a future version of this cookbook.

  • module_apc
  • module_curl
  • module_fileinfo
  • module_fpdf
  • module_gd
  • module_ldap
  • module_memcache
  • module_mysql
  • module_pgsql
  • module_sqlite3

The installation of the php modules in these recipes can now be accomplished by installing from a native package or via the new php_pear LWRP. For example, the functionality of the module_memcache recipe can be enabled in the following ways:

# using apt
package "php5-memcache" do
  action :install

# using pear LWRP
php_pear "memcache" do
  action :install


Simply include the php recipe where ever you would like php installed. To install from source override the node['php']['install_method'] attribute with in a role:

name "php"
description "Install php from source"
  "php" => {
    "install_method" => "source"


This section details "quick development" steps. For a detailed explanation, see [[]].

  1. Clone this repository from GitHub:

    $ git clone
  2. Create a git branch

    $ git checkout -b my_bug_fix
  3. Install dependencies:

    $ bundle install
  4. Make your changes/patches/fixes, committing appropiately

  5. Write tests

  6. Run the tests:

    • bundle exec foodcritic -f any .
    • bundle exec rspec
    • bundle exec rubocop
    • bundle exec kitchen test

In detail:
- Foodcritic will catch any Chef-specific style errors
- RSpec will run the unit tests
- Rubocop will check for Ruby-specific style errors
- Test Kitchen will run and converge the recipes

License & Authors

Copyright:: 2011, Opscode, Inc

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,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

build-essential >= 0.0.0
xml >= 0.0.0
mysql >= 0.0.0

Contingent cookbooks

aegir Applicable Versions
aegir2 Applicable Versions
aegir3 Applicable Versions
application Applicable Versions
application_php Applicable Versions
application_zf Applicable Versions
aws-php-elasticache Applicable Versions
beanstalk-console Applicable Versions
beanstalkd Applicable Versions
boilerplate_php Applicable Versions
boxbilling Applicable Versions
bricks Applicable Versions
cakephp Applicable Versions
composer Applicable Versions
drupal Applicable Versions
dvwa Applicable Versions
elefant Applicable Versions
frontaccounting Applicable Versions
gallery Applicable Versions
gotcms Applicable Versions
ish Applicable Versions
ish_mediawiki Applicable Versions
jenkins-php Applicable Versions
lamp_role Applicable Versions
laravel Applicable Versions
logstash Applicable Versions
lxmpbox Applicable Versions
magento Applicable Versions
magento-toolbox Applicable Versions
magerun Applicable Versions
mediawiki Applicable Versions
mx Applicable Versions
myface Applicable Versions
nagios Applicable Versions
newrelic Applicable Versions
newrelic-ng Applicable Versions
opencart Applicable Versions
oracle-instantclient Applicable Versions
owncloud Applicable Versions
pdepend Applicable Versions
phabricator Applicable Versions
phing Applicable Versions
php-box Applicable Versions
php-fpm Applicable Versions
php-ioncube Applicable Versions
php-mcrypt Applicable Versions
php-omnibus Applicable Versions
php5-mysql Applicable Versions
php_wrapper Applicable Versions
phpbb Applicable Versions
phpcb Applicable Versions
phpcpd Applicable Versions
phpcs Applicable Versions
phpdcd Applicable Versions
phpdoc Applicable Versions
phploc Applicable Versions
phpmd Applicable Versions
phpmyadmin Applicable Versions
phpstack Applicable Versions
phpunit Applicable Versions
pinba Applicable Versions
postfixadmin Applicable Versions
rackspace_apache_php Applicable Versions
rackspace_nginx_php Applicable Versions
rainloop Applicable Versions
roundcube Applicable Versions
stack_commons Applicable Versions
sugar_crm Applicable Versions
sugarcrm Applicable Versions
sugarcrm-ce Applicable Versions
sugarcrm_ce Applicable Versions
suhosin Applicable Versions
symfony Applicable Versions
teampass Applicable Versions
teamspeak Applicable Versions
testswarm Applicable Versions
tideways Applicable Versions
toran Applicable Versions
vicnum Applicable Versions
wordpress Applicable Versions
xdebug Applicable Versions
ya-piwik Applicable Versions
yourls Applicable Versions
zabbix Applicable Versions
zabbix-pkg Applicable Versions
zf2 Applicable Versions

No quality metric results found