Update cookbooks and add wordpress cookbook
This commit is contained in:
@@ -2,6 +2,31 @@ php Cookbook CHANGELOG
|
||||
======================
|
||||
This file is used to list changes made in each version of the php cookbook.
|
||||
|
||||
v1.7.2 (2015-8-24)
|
||||
------------------
|
||||
- Correct spelling in fpm_pool_start_servers (was servres)
|
||||
|
||||
v1.7.1 (2015-8-17)
|
||||
------------------
|
||||
- Correct permissions on ext_conf_dir folder (644 -> 755)
|
||||
|
||||
v1.7.0 (2015-7-31)
|
||||
------------------
|
||||
- NOTICE - This version changes the way the ['php']['directives'] is placed into configuration files. Quotes are no longer automatically placed around these aditional directives. Please take care when rolling out this version.
|
||||
- Allow additional PHP FPM config
|
||||
- Add recipe to recompile PHP from source
|
||||
- Move source dependencies to attributes file
|
||||
- Misc bug fixes
|
||||
|
||||
v1.6.0 (2015-7-6)
|
||||
-----------------
|
||||
- Added ChefSpec matchers
|
||||
- Added basic PHP-FPM Support (Pre-Release)
|
||||
- Added support for FreeBSD
|
||||
- Updated cookbook to use MySQL 6.0 cookbook
|
||||
- Update cookbook to use php5enmod on supported platforms
|
||||
- Allow users to override php-mysql package
|
||||
|
||||
v1.5.0 (2014-10-06)
|
||||
-------------------
|
||||
- Adding package_options attribute, utilizing in package resource
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
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.
|
||||
|
||||
[](https://gitter.im/opscode-cookbooks/php?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://supermarket.chef.io/cookbooks/php)
|
||||
[](https://travis-ci.org/opscode-cookbooks/php)
|
||||
|
||||
Installs and configures PHP 5.3 and the PEAR package management system. Also includes LWRPs for managing PEAR (and PECL) packages, PECL channels, and PHP-FPM pools.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
@@ -150,6 +155,42 @@ php_pear "YAML" do
|
||||
end
|
||||
```
|
||||
|
||||
### `php_fpm_pool`
|
||||
Installs the `php-fpm` package appropriate for your distro (if using packages)
|
||||
and configures a FPM pool for you. Currently only supported in Debian-family
|
||||
operating systems and CentOS 7 (or at least tested with such, YMMV if you are
|
||||
using source).
|
||||
|
||||
Please consider FPM functionally pre-release, and test it thoroughly in your environment before using it in production
|
||||
|
||||
More info: http://php.net/manual/en/install.fpm.php
|
||||
|
||||
#### Actions
|
||||
- :install: Installs the FPM pool (default).
|
||||
- :uninstall: Removes the FPM pool.
|
||||
|
||||
#### Attribute Parameters
|
||||
- pool_name: name attribute. The name of the FPM pool.
|
||||
- listen: The listen address. Default: `/var/run/php5-fpm.sock`
|
||||
- user: The user to run the FPM under. Default should be the webserver user for
|
||||
your distro.
|
||||
- group: The group to run the FPM under. Default should be the webserver group
|
||||
for your distro.
|
||||
- process_manager: Process manager to use - see
|
||||
http://php.net/manual/en/install.fpm.configuration.php. Default: `dynamic`
|
||||
- max_children: Max children to scale to. Default: 5
|
||||
- start_servers: Number of servers to start the pool with. Default: 2
|
||||
- min_spare_servers: Minimum number of servers to have as spares. Default: 1
|
||||
- max_spare_servers: Maximum number of servers to have as spares. Default: 3
|
||||
- chdir: The startup working directory of the pool. Default: `/`
|
||||
|
||||
#### Examples
|
||||
```ruby
|
||||
# Install a FPM pool named "default"
|
||||
php_fpm_pool "default" do
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
Recipes
|
||||
-------
|
||||
@@ -244,12 +285,12 @@ This section details "quick development" steps. For a detailed explanation, see
|
||||
|
||||
License & Authors
|
||||
-----------------
|
||||
- Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
- Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
- Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
- Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
- Author:: Julian C. Dunn (<jdunn@getchef.com>)
|
||||
|
||||
```text
|
||||
Copyright:: 2013, Chef Software, Inc.
|
||||
Copyright:: 2013-2014, Chef Software, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -269,29 +310,29 @@ Microsoft Windows platform only to correct an (upstream bug)[http://pear.php.net
|
||||
`go-pear.phar` is licensed under the (PHP License version 2.02)[http://www.php.net/license/2_02.txt]:
|
||||
|
||||
```
|
||||
--------------------------------------------------------------------
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 2.02
|
||||
Copyright (c) 1999 - 2002 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, is permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
3. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior permission from the
|
||||
|
||||
3. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior permission from the
|
||||
PHP Group. This does not apply to add-on libraries or tools
|
||||
that work in conjunction with PHP. In such a case the PHP
|
||||
name may be used to indicate that the product supports PHP.
|
||||
|
||||
|
||||
4. The PHP Group may publish revised and/or new versions of the
|
||||
license from time to time. Each version will be given a
|
||||
distinguishing version number.
|
||||
@@ -318,30 +359,30 @@ are met:
|
||||
modify the Zend Engine, or any portion thereof, your use of the
|
||||
separated or modified Zend Engine software shall not be governed
|
||||
by this license, and instead shall be governed by the license
|
||||
set forth at http://www.zend.com/license/ZendLicense/.
|
||||
set forth at http://www.zend.com/license/ZendLicense/.
|
||||
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals on behalf of the PHP Group.
|
||||
|
||||
The PHP Group can be contacted via Email at group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
```
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Attribute:: default
|
||||
#
|
||||
# Copyright 2011, Opscode, Inc.
|
||||
# Copyright 2011-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -34,23 +34,51 @@ when 'rhel', 'fedora'
|
||||
default['php']['fpm_user'] = 'nobody'
|
||||
default['php']['fpm_group'] = 'nobody'
|
||||
default['php']['ext_dir'] = "/usr/#{lib_dir}/php/modules"
|
||||
default['php']['src_deps'] = %w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel mhash-devel)
|
||||
if node['platform_version'].to_f < 6
|
||||
default['php']['packages'] = %w{ php53 php53-devel php53-cli php-pear }
|
||||
default['php']['packages'] = %w(php53 php53-devel php53-cli php-pear)
|
||||
default['php']['mysql']['package'] = 'php53-mysql'
|
||||
else
|
||||
default['php']['packages'] = %w{ php php-devel php-cli php-pear }
|
||||
default['php']['packages'] = %w(php php-devel php-cli php-pear)
|
||||
default['php']['mysql']['package'] = 'php-mysql'
|
||||
default['php']['fpm_package'] = 'php-fpm'
|
||||
default['php']['fpm_pooldir'] = '/etc/php-fpm.d'
|
||||
default['php']['fpm_default_conf'] = '/etc/php-fpm.d/www.conf'
|
||||
default['php']['fpm_service'] = 'php-fpm'
|
||||
if node['php']['install_method'] == 'package'
|
||||
default['php']['fpm_user'] = 'apache'
|
||||
default['php']['fpm_group'] = 'apache'
|
||||
end
|
||||
end
|
||||
when 'debian'
|
||||
default['php']['conf_dir'] = '/etc/php5/cli'
|
||||
default['php']['ext_conf_dir'] = '/etc/php5/conf.d'
|
||||
case node['platform']
|
||||
when 'ubuntu'
|
||||
if node['platform_version'].to_f >= 12.10
|
||||
default['php']['ext_conf_dir'] = '/etc/php5/mods-available'
|
||||
else
|
||||
default['php']['ext_conf_dir'] = '/etc/php5/conf.d'
|
||||
end
|
||||
else
|
||||
default['php']['ext_conf_dir'] = '/etc/php5/conf.d'
|
||||
end
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev)
|
||||
default['php']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear)
|
||||
default['php']['mysql']['package'] = 'php5-mysql'
|
||||
default['php']['fpm_package'] = 'php5-fpm'
|
||||
default['php']['fpm_pooldir'] = '/etc/php5/fpm/pool.d'
|
||||
default['php']['fpm_user'] = 'www-data'
|
||||
default['php']['fpm_group'] = 'www-data'
|
||||
default['php']['packages'] = %w{ php5-cgi php5 php5-dev php5-cli php-pear }
|
||||
default['php']['fpm_service'] = 'php5-fpm'
|
||||
default['php']['fpm_default_conf'] = '/etc/php5/fpm/pool.d/www.conf'
|
||||
when 'suse'
|
||||
default['php']['conf_dir'] = '/etc/php5/cli'
|
||||
default['php']['ext_conf_dir'] = '/etc/php5/conf.d'
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev)
|
||||
default['php']['fpm_user'] = 'wwwrun'
|
||||
default['php']['fpm_group'] = 'www'
|
||||
default['php']['packages'] = %w{ apache2-mod_php5 php5-pear }
|
||||
default['php']['packages'] = %w(apache2-mod_php5 php5-pear)
|
||||
default['php']['mysql']['package'] = 'php5-mysql'
|
||||
lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib'
|
||||
when 'windows'
|
||||
default['php']['windows']['msi_name'] = 'PHP 5.3.28'
|
||||
@@ -59,24 +87,34 @@ when 'windows'
|
||||
default['php']['conf_dir'] = 'C:\Program Files (x86)\PHP'
|
||||
default['php']['ext_conf_dir'] = node['php']['conf_dir']
|
||||
# These extensions are installed by default by the GUI MSI
|
||||
default['php']['packages'] = %w{ cgi ScriptExecutable PEAR
|
||||
iis4FastCGI ext_php_bz2 ext_php_curl
|
||||
ext_php_exif ext_php_gd2 ext_php_gettext
|
||||
ext_php_gmp ext_php_imap ext_php_mbstring
|
||||
ext_php_mysql ext_php_mysqli ext_php_openssl
|
||||
ext_php_pdo_mysql ext_php_pdo_odbc ext_php_pdo_sqlite
|
||||
ext_php_pgsql ext_php_soap ext_php_sockets
|
||||
ext_php_sqlite3 ext_php_tidy ext_php_xmlrpc
|
||||
}
|
||||
default['php']['package_options'] = "" # Use this to customise your yum or apt command
|
||||
default['php']['packages'] = %w(cgi ScriptExecutable PEAR
|
||||
iis4FastCGI ext_php_bz2 ext_php_curl
|
||||
ext_php_exif ext_php_gd2 ext_php_gettext
|
||||
ext_php_gmp ext_php_imap ext_php_mbstring
|
||||
ext_php_mysql ext_php_mysqli ext_php_openssl
|
||||
ext_php_pdo_mysql ext_php_pdo_odbc ext_php_pdo_sqlite
|
||||
ext_php_pgsql ext_php_soap ext_php_sockets
|
||||
ext_php_sqlite3 ext_php_tidy ext_php_xmlrpc
|
||||
)
|
||||
default['php']['package_options'] = '' # Use this to customise your yum or apt command
|
||||
default['php']['pear'] = 'pear.bat'
|
||||
default['php']['pecl'] = 'pecl.bat'
|
||||
when 'freebsd'
|
||||
default['php']['conf_dir'] = '/usr/local/etc'
|
||||
default['php']['ext_conf_dir'] = '/usr/local/etc/php'
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev)
|
||||
default['php']['fpm_user'] = 'www'
|
||||
default['php']['fpm_group'] = 'www'
|
||||
default['php']['packages'] = %w( php56 pear )
|
||||
default['php']['mysql']['package'] = 'php56-mysqli'
|
||||
else
|
||||
default['php']['conf_dir'] = '/etc/php5/cli'
|
||||
default['php']['ext_conf_dir'] = '/etc/php5/conf.d'
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev)
|
||||
default['php']['fpm_user'] = 'www-data'
|
||||
default['php']['fpm_group'] = 'www-data'
|
||||
default['php']['packages'] = %w{ php5-cgi php5 php5-dev php5-cli php-pear }
|
||||
default['php']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear)
|
||||
default['php']['mysql']['package'] = 'php5-mysql'
|
||||
end
|
||||
|
||||
default['php']['url'] = 'http://us1.php.net/get'
|
||||
@@ -84,7 +122,7 @@ default['php']['version'] = '5.5.9'
|
||||
default['php']['checksum'] = '378de162efdaeeb725ed38d7fe956c9f0b9084ff'
|
||||
default['php']['prefix_dir'] = '/usr/local'
|
||||
|
||||
default['php']['configure_options'] = %W{--prefix=#{php['prefix_dir']}
|
||||
default['php']['configure_options'] = %W(--prefix=#{php['prefix_dir']}
|
||||
--with-libdir=#{lib_dir}
|
||||
--with-config-file-path=#{php['conf_dir']}
|
||||
--with-config-file-scan-dir=#{php['ext_conf_dir']}
|
||||
@@ -120,7 +158,7 @@ default['php']['configure_options'] = %W{--prefix=#{php['prefix_dir']}
|
||||
--with-mysql-sock
|
||||
--with-sqlite3
|
||||
--with-pdo-mysql
|
||||
--with-pdo-sqlite}
|
||||
--with-pdo-sqlite)
|
||||
|
||||
default['php']['ini']['template'] = "php.ini.erb"
|
||||
default['php']['ini']['cookbook'] = "php"
|
||||
default['php']['ini']['template'] = 'php.ini.erb'
|
||||
default['php']['ini']['cookbook'] = 'php'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Libraries:: helpers
|
||||
#
|
||||
|
||||
35
cookbooks/php/libraries/matchers.rb
Normal file
35
cookbooks/php/libraries/matchers.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
if defined?(ChefSpec)
|
||||
ChefSpec.define_matcher :php_pear
|
||||
def install_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :install, resource_name)
|
||||
end
|
||||
|
||||
def remove_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :remove, resource_name)
|
||||
end
|
||||
|
||||
def upgrade_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :upgrade, resource_name)
|
||||
end
|
||||
|
||||
def purge_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :purge, resource_name)
|
||||
end
|
||||
|
||||
ChefSpec.define_matcher :php_pear_channel
|
||||
def discover_php_pear_channel(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :discover, resource_name)
|
||||
end
|
||||
|
||||
def remove_php_pear_channel(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :remove, resource_name)
|
||||
end
|
||||
|
||||
def update_php_pear_channel(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :update, resource_name)
|
||||
end
|
||||
|
||||
def add_php_pear_channel(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :add, resource_name)
|
||||
end
|
||||
end
|
||||
@@ -1,57 +1 @@
|
||||
{
|
||||
"name": "php",
|
||||
"version": "1.5.0",
|
||||
"description": "Installs and maintains php and php modules",
|
||||
"long_description": "",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"debian": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"redhat": ">= 0.0.0",
|
||||
"fedora": ">= 0.0.0",
|
||||
"scientific": ">= 0.0.0",
|
||||
"amazon": ">= 0.0.0",
|
||||
"windows": ">= 0.0.0",
|
||||
"oracle": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"build-essential": ">= 0.0.0",
|
||||
"xml": ">= 0.0.0",
|
||||
"mysql": ">= 0.0.0",
|
||||
"yum-epel": ">= 0.0.0",
|
||||
"windows": ">= 0.0.0",
|
||||
"iis": ">= 0.0.0"
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
"php": "Installs php",
|
||||
"php::package": "Installs php using packages.",
|
||||
"php::source": "Installs php from source.",
|
||||
"php::module_apc": "Install the php5-apc package",
|
||||
"php::module_curl": "Install the php5-curl package",
|
||||
"php::module_fileinfo": "Install the php5-fileinfo package",
|
||||
"php::module_fpdf": "Install the php-fpdf package",
|
||||
"php::module_gd": "Install the php5-gd package",
|
||||
"php::module_ldap": "Install the php5-ldap package",
|
||||
"php::module_memcache": "Install the php5-memcache package",
|
||||
"php::module_mysql": "Install the php5-mysql package",
|
||||
"php::module_pgsql": "Install the php5-pgsql packag",
|
||||
"php::module_sqlite3": "Install the php5-sqlite3 package"
|
||||
}
|
||||
}
|
||||
{"name":"php","version":"1.7.2","description":"Installs and maintains php and php modules","long_description":"","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@getchef.com","license":"Apache 2.0","platforms":{"debian":">= 0.0.0","ubuntu":">= 0.0.0","centos":">= 0.0.0","redhat":">= 0.0.0","fedora":">= 0.0.0","scientific":">= 0.0.0","amazon":">= 0.0.0","windows":">= 0.0.0","oracle":">= 0.0.0"},"dependencies":{"build-essential":">= 0.0.0","xml":">= 0.0.0","mysql":">= 6.0.0","yum-epel":">= 0.0.0","windows":">= 0.0.0","iis":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"php":"Installs php","php::package":"Installs php using packages.","php::source":"Installs php from source.","php::module_apc":"Install the php5-apc package","php::module_curl":"Install the php5-curl package","php::module_fileinfo":"Install the php5-fileinfo package","php::module_fpdf":"Install the php-fpdf package","php::module_gd":"Install the php5-gd package","php::module_ldap":"Install the php5-ldap package","php::module_memcache":"Install the php5-memcache package","php::module_mysql":"Install the php5-mysql package","php::module_pgsql":"Install the php5-pgsql packag","php::module_sqlite3":"Install the php5-sqlite3 package"}}
|
||||
@@ -1,31 +0,0 @@
|
||||
name 'php'
|
||||
maintainer 'Opscode, Inc.'
|
||||
maintainer_email 'cookbooks@opscode.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs and maintains php and php modules'
|
||||
version '1.5.0'
|
||||
|
||||
depends 'build-essential'
|
||||
depends 'xml'
|
||||
depends 'mysql'
|
||||
depends 'yum-epel'
|
||||
depends 'windows'
|
||||
depends 'iis'
|
||||
|
||||
%w{ debian ubuntu centos redhat fedora scientific amazon windows oracle }.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
recipe 'php', 'Installs php'
|
||||
recipe 'php::package', 'Installs php using packages.'
|
||||
recipe 'php::source', 'Installs php from source.'
|
||||
recipe 'php::module_apc', 'Install the php5-apc package'
|
||||
recipe 'php::module_curl', 'Install the php5-curl package'
|
||||
recipe 'php::module_fileinfo', 'Install the php5-fileinfo package'
|
||||
recipe 'php::module_fpdf', 'Install the php-fpdf package'
|
||||
recipe 'php::module_gd', 'Install the php5-gd package'
|
||||
recipe 'php::module_ldap', 'Install the php5-ldap package'
|
||||
recipe 'php::module_memcache', 'Install the php5-memcache package'
|
||||
recipe 'php::module_mysql', 'Install the php5-mysql package'
|
||||
recipe 'php::module_pgsql', 'Install the php5-pgsql packag'
|
||||
recipe 'php::module_sqlite3', 'Install the php5-sqlite3 package'
|
||||
86
cookbooks/php/providers/fpm_pool.rb
Normal file
86
cookbooks/php/providers/fpm_pool.rb
Normal file
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
|
||||
# Cookbook Name:: php
|
||||
# Provider:: fpm_pool
|
||||
#
|
||||
# Copyright:: 2015, Opscode, Inc <legal@opscode.com>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
def install_fpm_package
|
||||
# Install the FPM pacakge for this platform, if it's available
|
||||
# Fail the run if it's an unsupported OS (FPM pacakge name not populated)
|
||||
# also, this is skipped for source
|
||||
return if node['php']['install_method'] == 'source'
|
||||
|
||||
if node['php']['fpm_package'].nil?
|
||||
raise 'PHP-FPM package not found (you probably have an unsupported distro)'
|
||||
else
|
||||
file node['php']['fpm_default_conf'] do
|
||||
action :nothing
|
||||
end
|
||||
package node['php']['fpm_package'] do
|
||||
action :install
|
||||
notifies :delete, "file[#{node['php']['fpm_default_conf']}]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def register_fpm_service
|
||||
service node['php']['fpm_service'] do
|
||||
action :enable
|
||||
end
|
||||
end
|
||||
|
||||
action :install do
|
||||
# Ensure the FPM pacakge is installed, and the service is registered
|
||||
install_fpm_package
|
||||
register_fpm_service
|
||||
# I wanted to have this as a function in itself, but doing this seems to
|
||||
# break testing suites?
|
||||
t = template "#{node['php']['fpm_pooldir']}/#{new_resource.pool_name}.conf" do
|
||||
source 'fpm-pool.conf.erb'
|
||||
action :create
|
||||
cookbook 'php'
|
||||
variables ({
|
||||
:fpm_pool_name => new_resource.pool_name,
|
||||
:fpm_pool_user => new_resource.user,
|
||||
:fpm_pool_group => new_resource.group,
|
||||
:fpm_pool_listen => new_resource.listen,
|
||||
:fpm_pool_manager => new_resource.process_manager,
|
||||
:fpm_pool_max_children => new_resource.max_children,
|
||||
:fpm_pool_start_servers => new_resource.start_servers,
|
||||
:fpm_pool_min_spare_servers => new_resource.min_spare_servers,
|
||||
:fpm_pool_max_spare_servers => new_resource.max_spare_servers,
|
||||
:fpm_pool_chdir => new_resource.chdir,
|
||||
:fpm_pool_additional_config => new_resource.additional_config
|
||||
})
|
||||
notifies :restart, "service[#{node['php']['fpm_package']}]"
|
||||
end
|
||||
new_resource.updated_by_last_action(t.updated_by_last_action?)
|
||||
end
|
||||
|
||||
action :uninstall do
|
||||
# Ensure the FPM pacakge is installed, and the service is registered
|
||||
register_fpm_service
|
||||
# Delete the FPM pool.
|
||||
f = file "#{node['php']['fpm_pooldir']}/#{new_resource.pool_name}" do
|
||||
action :delete
|
||||
end
|
||||
new_resource.updated_by_last_action(f.updated_by_last_action?)
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@opscode.com>
|
||||
# Author:: Seth Chisamore <schisamo@getchef.com>
|
||||
# Cookbook Name:: php
|
||||
# Provider:: pear_package
|
||||
#
|
||||
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
|
||||
# Copyright:: 2011, Opscode, Inc <legal@getchef.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -64,7 +64,6 @@ action :remove do
|
||||
Chef::Log.info("Removing #{@new_resource}")
|
||||
remove_package(@current_resource.package_name, @new_resource.version)
|
||||
end
|
||||
else
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,10 +116,9 @@ end
|
||||
|
||||
def current_installed_version
|
||||
@current_installed_version ||= begin
|
||||
v = nil
|
||||
version_check_cmd = "#{@bin} -d "
|
||||
version_check_cmd << " preferred_state=#{can_haz(@new_resource, "preferred_state")}"
|
||||
version_check_cmd << " list#{expand_channel(can_haz(@new_resource, "channel"))}"
|
||||
version_check_cmd << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
version_check_cmd << " list#{expand_channel(can_haz(@new_resource, 'channel'))}"
|
||||
p = shell_out(version_check_cmd)
|
||||
response = nil
|
||||
response = grep_for_version(p.stdout, @new_resource.package_name) if p.stdout =~ /\.?Installed packages/i
|
||||
@@ -131,9 +129,9 @@ end
|
||||
def candidate_version
|
||||
@candidate_version ||= begin
|
||||
candidate_version_cmd = "#{@bin} -d "
|
||||
candidate_version_cmd << "preferred_state=#{can_haz(@new_resource, "preferred_state")}"
|
||||
candidate_version_cmd << " search#{expand_channel(can_haz(@new_resource, "channel"))}"
|
||||
candidate_version_cmd << "#{@new_resource.package_name}"
|
||||
candidate_version_cmd << "preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
candidate_version_cmd << " search#{expand_channel(can_haz(@new_resource, 'channel'))}"
|
||||
candidate_version_cmd << " #{@new_resource.package_name}"
|
||||
p = shell_out(candidate_version_cmd)
|
||||
response = nil
|
||||
response = grep_for_version(p.stdout, @new_resource.package_name) if p.stdout =~ /\.?Matched packages/i
|
||||
@@ -142,32 +140,47 @@ def candidate_version
|
||||
end
|
||||
|
||||
def install_package(name, version)
|
||||
command = "echo \"\r\" | #{@bin} -d"
|
||||
command << " preferred_state=#{can_haz(@new_resource, "preferred_state")}"
|
||||
command = "printf \"\r\" | #{@bin} -d"
|
||||
command << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
command << " install -a#{expand_options(@new_resource.options)}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}"
|
||||
command << "-#{version}" if version && !version.empty?
|
||||
pear_shell_out(command)
|
||||
manage_pecl_ini(name, :create, can_haz(@new_resource, 'directives'), can_haz(@new_resource, 'zend_extensions')) if pecl?
|
||||
enable_package(name)
|
||||
end
|
||||
|
||||
def upgrade_package(name, version)
|
||||
command = "echo \"\r\" | #{@bin} -d"
|
||||
command << " preferred_state=#{can_haz(@new_resource, "preferred_state")}"
|
||||
command = "printf \"\r\" | #{@bin} -d"
|
||||
command << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
command << " upgrade -a#{expand_options(@new_resource.options)}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}"
|
||||
command << "-#{version}" if version && !version.empty?
|
||||
pear_shell_out(command)
|
||||
manage_pecl_ini(name, :create, can_haz(@new_resource, 'directives'), can_haz(@new_resource, 'zend_extensions')) if pecl?
|
||||
enable_package(name)
|
||||
end
|
||||
|
||||
def remove_package(name, version)
|
||||
command = "#{@bin} uninstall"
|
||||
command << " #{expand_options(@new_resource.options)}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}"
|
||||
command << "-#{version}" if version && !version.empty?
|
||||
pear_shell_out(command)
|
||||
manage_pecl_ini(name, :delete) if pecl?
|
||||
disable_package(name)
|
||||
manage_pecl_ini(name, :delete, nil, nil) if pecl?
|
||||
end
|
||||
|
||||
def enable_package(name)
|
||||
execute "/usr/sbin/php5enmod #{name}" do
|
||||
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?('/usr/sbin/php5enmod') }
|
||||
end
|
||||
end
|
||||
|
||||
def disable_package(name)
|
||||
execute "/usr/sbin/php5dismod #{name}" do
|
||||
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?('/usr/sbin/php5dismod') }
|
||||
end
|
||||
end
|
||||
|
||||
def pear_shell_out(command)
|
||||
@@ -216,14 +229,21 @@ def manage_pecl_ini(name, action, directives, zend_extensions)
|
||||
files = get_extension_files(name)
|
||||
|
||||
extensions = Hash[
|
||||
files.map do |filepath|
|
||||
rel_file = filepath.clone
|
||||
rel_file.slice! ext_prefix if rel_file.start_with? ext_prefix
|
||||
zend = zend_extensions.include?(rel_file)
|
||||
[(zend ? filepath : rel_file) , zend]
|
||||
end
|
||||
files.map do |filepath|
|
||||
rel_file = filepath.clone
|
||||
rel_file.slice! ext_prefix if rel_file.start_with? ext_prefix
|
||||
zend = zend_extensions.include?(rel_file)
|
||||
[(zend ? filepath : rel_file), zend]
|
||||
end
|
||||
]
|
||||
|
||||
directory "#{node['php']['ext_conf_dir']}" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
recursive true
|
||||
end
|
||||
|
||||
template "#{node['php']['ext_conf_dir']}/#{name}.ini" do
|
||||
source 'extension.ini.erb'
|
||||
cookbook 'php'
|
||||
@@ -259,9 +279,9 @@ def pecl?
|
||||
@pecl ||=
|
||||
begin
|
||||
# search as a pear first since most 3rd party channels will report pears as pecls!
|
||||
search_args = String.new
|
||||
search_args << " -d preferred_state=#{can_haz(@new_resource, "preferred_state")}"
|
||||
search_args << " search#{expand_channel(can_haz(@new_resource, "channel"))} #{@new_resource.package_name}"
|
||||
search_args = ''
|
||||
search_args << " -d preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
search_args << " search#{expand_channel(can_haz(@new_resource, 'channel'))} #{@new_resource.package_name}"
|
||||
|
||||
if grep_for_version(shell_out(node['php']['pear'] + search_args).stdout, @new_resource.package_name)
|
||||
false
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@opscode.com>
|
||||
# Author:: Seth Chisamore <schisamo@getchef.com>
|
||||
# Cookbook Name:: php
|
||||
# Provider:: pear_channel
|
||||
#
|
||||
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
|
||||
# Copyright:: 2011, Opscode, Inc <legal@getchef.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -84,10 +84,8 @@ end
|
||||
private
|
||||
|
||||
def exists?
|
||||
begin
|
||||
shell_out!("#{node['php']['pear']} channel-info #{@current_resource.channel_name}")
|
||||
true
|
||||
rescue Mixlib::ShellOut::ShellCommandFailed
|
||||
false
|
||||
end
|
||||
shell_out!("#{node['php']['pear']} channel-info #{@current_resource.channel_name}")
|
||||
true
|
||||
rescue Mixlib::ShellOut::ShellCommandFailed
|
||||
false
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -30,4 +30,4 @@ php_pear_channel 'pecl.php.net' do
|
||||
action :update
|
||||
end
|
||||
|
||||
include_recipe "php::ini"
|
||||
include_recipe 'php::ini'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: ini
|
||||
#
|
||||
# Copyright 2011, Opscode, Inc.
|
||||
# Copyright 2011-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -19,12 +19,12 @@
|
||||
#
|
||||
|
||||
template "#{node['php']['conf_dir']}/php.ini" do
|
||||
source node['php']['ini']['template']
|
||||
cookbook node['php']['ini']['cookbook']
|
||||
unless platform?('windows')
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
end
|
||||
variables(:directives => node['php']['directives'])
|
||||
source node['php']['ini']['template']
|
||||
cookbook node['php']['ini']['cookbook']
|
||||
unless platform?('windows')
|
||||
owner 'root'
|
||||
group node['root_group']
|
||||
mode '0644'
|
||||
end
|
||||
variables(:directives => node['php']['directives'])
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_apc
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora'
|
||||
%w{ httpd-devel pcre pcre-devel }.each do |pkg|
|
||||
%w(httpd-devel pcre pcre-devel).each do |pkg|
|
||||
package pkg do
|
||||
action :install
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_curl
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_fpdf
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_gd
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,9 @@ pkg = value_for_platform(
|
||||
el5_range => 'php53-gd',
|
||||
'default' => 'php-gd'
|
||||
},
|
||||
'freebsd' => {
|
||||
'default' => 'php56-gd'
|
||||
},
|
||||
'default' => 'php5-gd'
|
||||
)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_ldap
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_memcache
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora'
|
||||
%w{ zlib-devel }.each do |pkg|
|
||||
%w(zlib-devel).each do |pkg|
|
||||
package pkg do
|
||||
action :install
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_mysql
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -19,14 +19,6 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
pkg = value_for_platform(
|
||||
%w(centos redhat scientific fedora amazon oracle) => {
|
||||
el5_range => 'php53-mysql',
|
||||
'default' => 'php-mysql'
|
||||
},
|
||||
'default' => 'php5-mysql'
|
||||
)
|
||||
|
||||
package pkg do
|
||||
package node['php']['mysql']['package'] do
|
||||
action :install
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_pgsql
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Joshua Timberman (<joshua@getchef.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: module_sqlite3
|
||||
#
|
||||
# Copyright 2009-2011, Opscode, Inc.
|
||||
# Copyright 2009-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Lucas Hansen (<lucash@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Author:: Lucas Hansen (<lucash@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: package
|
||||
#
|
||||
# Copyright 2013, Opscode, Inc.
|
||||
# Copyright 2013-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -28,11 +28,11 @@ if platform?('windows')
|
||||
source node['php']['windows']['msi_source']
|
||||
installer_type :msi
|
||||
|
||||
options %W[
|
||||
/quiet
|
||||
INSTALLDIR="#{install_dir}"
|
||||
ADDLOCAL=#{node['php']['packages'].join(',')}
|
||||
].join(' ')
|
||||
options %W(
|
||||
/quiet
|
||||
INSTALLDIR="#{install_dir}"
|
||||
ADDLOCAL=#{node['php']['packages'].join(',')}
|
||||
).join(' ')
|
||||
end
|
||||
|
||||
# WARNING: This is not the out-of-the-box go-pear.phar. It's been modified to patch this bug:
|
||||
@@ -63,4 +63,4 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
include_recipe "php::ini"
|
||||
include_recipe 'php::ini'
|
||||
|
||||
51
cookbooks/php/recipes/recompile.rb
Normal file
51
cookbooks/php/recipes/recompile.rb
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Author:: David Kinzer (<dtkinzer@gmail.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: recompile
|
||||
#
|
||||
# Copyright 2014, David Kinzer
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
version = node['php']['version']
|
||||
configure_options = node['php']['configure_options'].join(' ')
|
||||
ext_dir_prefix = node['php']['ext_dir'] ? "EXTENSION_DIR=#{node['php']['ext_dir']}" : ''
|
||||
|
||||
node['php']['src_deps'].each do |pkg|
|
||||
package pkg do
|
||||
action 'install'
|
||||
end
|
||||
end
|
||||
|
||||
remote_file "#{Chef::Config[:file_cache_path]}/php-#{version}.tar.gz" do
|
||||
source "#{node['php']['url']}/php-#{version}.tar.gz/from/this/mirror"
|
||||
checksum node['php']['checksum']
|
||||
mode '0644'
|
||||
action 'create_if_missing'
|
||||
end
|
||||
|
||||
bash 'un-pack php' do
|
||||
cwd Chef::Config[:file_cache_path]
|
||||
code "tar -zxf php-#{version}.tar.gz"
|
||||
creates "#{node['php']['url']}/php-#{version}"
|
||||
end
|
||||
|
||||
bash 're-build php' do
|
||||
cwd "#{Chef::Config[:file_cache_path]}/php-#{version}"
|
||||
code <<-EOF
|
||||
(make clean)
|
||||
(#{ext_dir_prefix} ./configure #{configure_options})
|
||||
(make && make install)
|
||||
EOF
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
# Author:: Seth Chisamore (<schisamo@getchef.com>)
|
||||
# Cookbook Name:: php
|
||||
# Recipe:: package
|
||||
#
|
||||
# Copyright 2011, Opscode, Inc.
|
||||
# Copyright 2011-2014, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -22,16 +22,14 @@ configure_options = node['php']['configure_options'].join(' ')
|
||||
|
||||
include_recipe 'build-essential'
|
||||
include_recipe 'xml'
|
||||
include_recipe 'mysql::client' if configure_options =~ /mysql/
|
||||
include_recipe 'yum-epel' if node['platform_family'] == 'rhel'
|
||||
|
||||
pkgs = value_for_platform_family(
|
||||
%w{ rhel fedora } => %w{ bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel mhash-devel },
|
||||
%w{ debian ubuntu } => %w{ libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev },
|
||||
'default' => %w{ libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev }
|
||||
)
|
||||
mysql_client 'default' do
|
||||
action :create
|
||||
only_if { configure_options =~ /mysql/ }
|
||||
end
|
||||
|
||||
pkgs.each do |pkg|
|
||||
node['php']['src_deps'].each do |pkg|
|
||||
package pkg do
|
||||
action :install
|
||||
end
|
||||
@@ -82,4 +80,4 @@ directory node['php']['ext_conf_dir'] do
|
||||
recursive true
|
||||
end
|
||||
|
||||
include_recipe "php::ini"
|
||||
include_recipe 'php::ini'
|
||||
|
||||
34
cookbooks/php/resources/fpm_pool.rb
Normal file
34
cookbooks/php/resources/fpm_pool.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
|
||||
# Cookbook Name:: php
|
||||
# Resource:: fpm_pool
|
||||
#
|
||||
# Copyright:: 2015, Opscode, Inc <legal@opscode.com>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
default_action :install
|
||||
actions :install, :uninstall
|
||||
|
||||
attribute :pool_name, :kind_of => String, :name_attribute => true
|
||||
attribute :listen, :default => '/var/run/php5-fpm.sock'
|
||||
attribute :user, :kind_of => String, :default => node['php']['fpm_user']
|
||||
attribute :group, :kind_of => String, :default => node['php']['fpm_user']
|
||||
attribute :process_manager, :kind_of => String, :default => 'dynamic'
|
||||
attribute :max_children, :kind_of => Integer, :default => 5
|
||||
attribute :start_servers, :kind_of => Integer, :default => 2
|
||||
attribute :min_spare_servers, :kind_of => Integer, :default => 1
|
||||
attribute :max_spare_servers, :kind_of => Integer, :default => 3
|
||||
attribute :chdir, :kind_of => String, :default => '/'
|
||||
attribute :additional_config, :kind_of => Hash, :default => {}
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@opscode.com>
|
||||
# Author:: Seth Chisamore <schisamo@getchef.com>
|
||||
# Cookbook Name:: php
|
||||
# Resource:: pear_package
|
||||
#
|
||||
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
|
||||
# Copyright:: 2011-2014, Chef Software, Inc <legal@getchef.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,14 @@
|
||||
default_action :install
|
||||
actions :install, :upgrade, :remove, :purge
|
||||
|
||||
state_attrs :channel,
|
||||
:directives,
|
||||
:options,
|
||||
:package_name,
|
||||
:preferred_state,
|
||||
:version,
|
||||
:zend_extensions
|
||||
|
||||
attribute :package_name, :kind_of => String, :name_attribute => true
|
||||
attribute :version, :default => nil
|
||||
attribute :channel, :kind_of => String
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@opscode.com>
|
||||
# Author:: Seth Chisamore <schisamo@getchef.com>
|
||||
# Cookbook Name:: php
|
||||
# Resource:: pear_channel
|
||||
#
|
||||
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
|
||||
# Copyright:: 2011-2014, Chef Software, Inc <legal@getchef.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,9 @@
|
||||
default_action :discover
|
||||
actions :discover, :add, :update, :remove
|
||||
|
||||
state_attrs :channel_name,
|
||||
:channel_xml
|
||||
|
||||
attribute :channel_name, :kind_of => String, :name_attribute => true
|
||||
attribute :channel_xml, :kind_of => String
|
||||
|
||||
|
||||
@@ -1221,5 +1221,5 @@ soap.wsdl_cache_ttl=86400
|
||||
; End:
|
||||
|
||||
<% @directives.sort_by { |key, val| key }.each do |directive, value| -%>
|
||||
<%= "#{directive}=\"#{value}\"" %>
|
||||
<%= "#{directive}=#{value}" %>
|
||||
<% end -%>
|
||||
|
||||
@@ -1853,5 +1853,5 @@ ldap.max_links = -1
|
||||
; End:
|
||||
|
||||
<% @directives.sort_by { |key, val| key }.each do |directive, value| -%>
|
||||
<%= "#{directive}=\"#{value}\"" %>
|
||||
<%= "#{directive}=#{value}" %>
|
||||
<% end -%>
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<%= 'zend_' if zend %>extension=<%= filepath %>
|
||||
<% end -%>
|
||||
<% @directives.each do |k,v| -%>
|
||||
<%= "#{@name}.#{k}=\"#{v}\"" %>
|
||||
<%= "#{@name}.#{k}=#{v}" %>
|
||||
<% end -%>
|
||||
|
||||
15
cookbooks/php/templates/default/fpm-pool.conf.erb
Normal file
15
cookbooks/php/templates/default/fpm-pool.conf.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
[<%= @fpm_pool_name %>]
|
||||
user = <%= @fpm_pool_user %>
|
||||
group = <%= @fpm_pool_group %>
|
||||
listen = <%= @fpm_pool_listen %>
|
||||
listen.owner = <%= @fpm_pool_user %>
|
||||
listen.group = <%= @fpm_pool_group %>
|
||||
pm = <%= @fpm_pool_manager %>
|
||||
pm.max_children = <%= @fpm_pool_max_children %>
|
||||
pm.start_servers = <%= @fpm_pool_start_servers %>
|
||||
pm.min_spare_servers = <%= @fpm_pool_min_spare_servers %>
|
||||
pm.max_spare_servers = <%= @fpm_pool_max_spare_servers %>
|
||||
chdir = <%= @fpm_pool_chdir %>
|
||||
<% @fpm_pool_additional_config.each do |key, value| %>
|
||||
<%= key %> = <%= value %>
|
||||
<% end %>
|
||||
@@ -1896,5 +1896,5 @@ ldap.max_links = -1
|
||||
; End:
|
||||
|
||||
<% @directives.sort_by { |key, val| key }.each do |directive, value| -%>
|
||||
<%= "#{directive}=\"#{value}\"" %>
|
||||
<%= "#{directive}=#{value}" %>
|
||||
<% end -%>
|
||||
|
||||
@@ -1221,5 +1221,5 @@ soap.wsdl_cache_ttl=86400
|
||||
; End:
|
||||
|
||||
<% @directives.sort_by { |key, val| key }.each do |directive, value| -%>
|
||||
<%= "#{directive}=\"#{value}\"" %>
|
||||
<%= "#{directive}=#{value}" %>
|
||||
<% end -%>
|
||||
|
||||
@@ -1853,5 +1853,5 @@ ldap.max_links = -1
|
||||
; End:
|
||||
|
||||
<% @directives.sort_by { |key, val| key }.each do |directive, value| -%>
|
||||
<%= "#{directive}=\"#{value}\"" %>
|
||||
<%= "#{directive}=#{value}" %>
|
||||
<% end -%>
|
||||
|
||||
@@ -1931,5 +1931,5 @@ extension=php_exif.dll
|
||||
include_path=".;<%= node['php']['conf_dir'].gsub('/', '\\') %>"
|
||||
|
||||
<% @directives.each do |directive, value| -%>
|
||||
<%= "#{directive}=\"#{value}\"" %>
|
||||
<%= "#{directive}=#{value}" %>
|
||||
<% end -%>
|
||||
|
||||
Reference in New Issue
Block a user