Update cookbooks for Ubuntu 16.04 TLS

This commit is contained in:
Greg Karékinian
2017-03-31 19:20:00 +02:00
parent 6430d71006
commit 8923d0d7ef
219 changed files with 2770 additions and 11511 deletions

View File

@@ -1,25 +1,102 @@
php Cookbook CHANGELOG
======================
# php Cookbook CHANGELOG
This file is used to list changes made in each version of the php cookbook.
v1.7.2 (2015-8-24)
------------------
## 3.0.0 (2017-03-27)
- Converted pear_channel LWRP into custom resource
- Removed use of pear node attribute from pear_channel resource
- Fix cookstyle issue with missing line on metadata.rb
- Clean up kitchen.dokken.yml file to eliminate duplication of testing suites.
- Eliminate duplicated resource from test cookbook that is in the default recipe.
- Rename php-test to standard cookbook testing cookbook of "test"
- Remove EOL ubuntu platform logic
**NOTE** Windows package installation is currently broken.
## 2.2.1 (2017-02-21)
- Fix double definition of ['php']['packages'] for rhel.
## 2.2.0 (2016-12-12)
- Use multipackage for installs to speed up chef runs
- Use all CPUs when building from source
- Remove need for apt/yum in testing
- Add opensuse to the metadata
- Migrate to inspec for integration testing
## 2.1.1 (2016-09-15)
- Fix recompile un-pack php creates
- Resolve cookstyle warnings
## 2.1.0 (2016-09-14)
- Fix source php version check
- Require Chef 12.1 not 12.0
## 2.0.0 (2016-09-07)
- Require Chef 12+
- Remove the dependency on the Windows cookbook which isn't necessary with Chef 12+
## 1.10.1 (2016-08-30)
- [fix] bug fixes related with Ubuntu 16.04 and PHP 7 support
- adding validator to listen attribute
- Fix node.foo.bar warnings
## v1.10.0 (2016-07-27)
- PR #167 Preventing user specified pool of www from being deleted at the end of the chef run on the first install
- PR #122 Add recipe for php module_imap
- PR #172 Fix uninstall action for resource php_fpm_pool
## v1.9.0 (2016-05-12)
Special thanks to @ThatGerber for getting the PR for this release together
- Added support for Ubuntu 16.04 and PHP 7
- Added support for different listen user/groups with FPM
- Cleaned up resource notification in the pear_channel provider to simplify code
- Fixed Ubuntu 14.04+ not being able to find the GMP library
## v1.8.0 (2016-02-25)
- Bumped the source install default version from 5.5.9 to 5.6.13
- Added a chefignore file to limit the files uploaded to the Chef server
- Added source_url and issues_url to the metadata.rb
- Added additional Chefspec matchers
- Added a Chef standard rubocop.yml file and resolved warnings
- Added serverspec for integration testing
- Remove legacy cloud Test Kitchen configs
- Added testing in Travis CI with kitchen-docker
- Added additional test suites to the Test Kitchen config
- Updated contributing and testing documentation
- Updated testing gem dependencies to the latest
- Added maintainers.md and maintainers.toml files
- Remove gitter chat from the readme
- Add cookbook version badge to the readme
- Added Fedora as a supported platform in the readme
- Add missing cookbook dependencies to the readme
## v1.7.2 (2015-8-24)
- Correct spelling in fpm_pool_start_servers (was servres)
v1.7.1 (2015-8-17)
------------------
## v1.7.1 (2015-8-17)
- Correct permissions on ext_conf_dir folder (644 -> 755)
v1.7.0 (2015-7-31)
------------------
## 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)
-----------------
## v1.6.0 (2015-7-6)
- Added ChefSpec matchers
- Added basic PHP-FPM Support (Pre-Release)
- Added support for FreeBSD
@@ -27,138 +104,134 @@ v1.6.0 (2015-7-6)
- Update cookbook to use php5enmod on supported platforms
- Allow users to override php-mysql package
v1.5.0 (2014-10-06)
-------------------
## v1.5.0 (2014-10-06)
- Adding package_options attribute, utilizing in package resource
v1.4.6 (2014-03-19)
-------------------
## v1.4.6 (2014-03-19)
- [COOK-4436] - Test this cookbook, not yum. Also test Fedora 20.
- [COOK-4427] - Add oracle as supported operating system
## v1.4.4 (2014-03-12)
v1.4.4 (2014-03-12)
-------------------
- [COOK-4393] - Fix convergence bug in source install
## v1.4.2 (2014-02-27)
v1.4.2 (2014-02-27)
-------------------
[COOK-4300] - Simplified and fixed pear/pecl logic. [Fixes #56 / #57]
## v1.4.0 (2014-02-27)
v1.4.0 (2014-02-27)
-------------------
[COOK-3639] - Allow users to specify php.ini source template
## v1.3.14 (2014-02-21)
v1.3.14 (2014-02-21)
--------------------
### Bug
- **[COOK-4186](https://tickets.opscode.com/browse/COOK-4186)** - Upgrade_package concatenates an empty version string when version is not set or is empty.
## v1.3.12 (2014-01-28)
v1.3.12 (2014-01-28)
--------------------
Fix github issue 'Cannot find a resource for preferred_state'
## v1.3.10
v1.3.10
-------
Fixing my stove
## v1.3.8
v1.3.8
------
Version bump to ensure artifact sanity
## v1.3.6
v1.3.6
------
Version bump for toolchain
## v1.3.4
v1.3.4
------
Adding platform_family check to include_recipe in source.rb
## v1.3.2
v1.3.2
------
Fixing style cops. Updating test harness
## v1.3.0
v1.3.0
------
### Bug
- **[COOK-3479](https://tickets.opscode.com/browse/COOK-3479)** - Added Windows support to PHP
- **[COOK-2909](https://tickets.opscode.com/browse/COOK-2909)** - Warnings about Chef::Exceptions::ShellCommandFailed is deprecated
## v1.2.6
v1.2.6
------
### Bug
- **[COOK-3628](https://tickets.opscode.com/browse/COOK-3628)** - Fix PHP download URL
- **[COOK-3568](https://tickets.opscode.com/browse/COOK-3568)** - Fix Test Kitchen tests
- **[COOK-3402](https://tickets.opscode.com/browse/COOK-3402)** - When the `ext_dir` setting is present, configure php properly for the source recipe
- **[COOK-2926](https://tickets.opscode.com/browse/COOK-2926)** - Fix pear package detection when installing specific version
## v1.2.4
v1.2.4
------
### Improvement
- **[COOK-3047](https://tickets.opscode.com/browse/COOK-3047)** - Sort directives in `php.ini`
- **[COOK-2928](https://tickets.opscode.com/browse/COOK-2928)** - Abstract `php.ini` directives into variables
### Bug
- **[COOK-2378](https://tickets.opscode.com/browse/COOK-2378)** - Fix `php_pear` for libevent
v1.2.2
------
## v1.2.2
### Bug
- [COOK-3050]: `lib_dir` declared in wrong place for redhat
- [COOK-3102]: remove fileinfo recipe from php cookbook
### Improvement
- [COOK-3101]: use a method to abstract range of "el 5" versions in php recipes
v1.2.0
------
## v1.2.0
### Improvement
- [COOK-2516]: Better support for SUSE distribution for php cookbook
- [COOK-3035]: update php::source to install 5.4.15 by default
### Bug
- [COOK-2463]: PHP PEAR Provider Installs Most Recent Version, Without Respect to Preferred State
- [COOK-2514]: php_pear: does not handle more exotic version strings
v1.1.8
------
## v1.1.8
- [COOK-1998] - Enable override of PHP packages in attributes
v1.1.6
------
## v1.1.6
- [COOK-2324] - adds Oracle linux support
v1.1.4
------
## v1.1.4
- [COOK-2106] - `php_pear` cannot find available packages
v1.1.2
------
## v1.1.2
- [COOK-1803] - use better regexp to match package name
- [COOK-1926] - support Amazon linux
v1.1.0
------
## v1.1.0
- [COOK-543] - php.ini template should be configurable
- [COOK-1067] - support for PECL zend extensions
- [COOK-1193] - update package names for EPEL 6
- [COOK-1348] - rescue Mixlib::ShellOut::ShellCommandFailed (chef 0.10.10)
- [COOK-1465] - fix pear extension template
v1.0.2
------
## v1.0.2
- [COOK-993] Add mhash-devel to centos php source libs
- [COOK-989] - bump version of php to 5.3.10
- Also download the .tar.gz instead of .tar.bz2 as bzip2 may not be in the base OS (e.g., CentOS 6 minimal)

View File

@@ -0,0 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD

View File

@@ -0,0 +1,15 @@
<!-- This is a generated file. Please do not edit directly -->
# Maintainers
This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead.
# Project Maintainer
* [Tim Smith](https://github.com/tas50)
# Maintainers
* [Jennifer Davis](https://github.com/sigje)
* [Tim Smith](https://github.com/tas50)
* [Thom May](https://github.com/thommay)

View File

@@ -1,47 +1,40 @@
php Cookbook
============
# php Cookbook
[![Build Status](https://travis-ci.org/chef-cookbooks/php.svg?branch=master)](http://travis-ci.org/chef-cookbooks/php) [![Cookbook Version](https://img.shields.io/cookbook/v/php.svg)](https://supermarket.chef.io/cookbooks/php)
[![Join the chat at https://gitter.im/opscode-cookbooks/php](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/opscode-cookbooks/php?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Cookbook Version](https://img.shields.io/cookbook/v/php.svg)](https://supermarket.chef.io/cookbooks/php)
[![Build Status](https://travis-ci.org/opscode-cookbooks/php.svg?branch=master)](https://travis-ci.org/opscode-cookbooks/php)
It installs and configures PHP and the PEAR package management system. Also includes resources for managing PEAR (and PECL) packages, PECL channels, and PHP-FPM pools.
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
------------
## Requirements
### Platforms
- Debian, Ubuntu
- CentOS, Red Hat, Fedora, Amazon Linux
- Microsoft Windows
- CentOS, Red Hat, Oracle, Scientific, Amazon Linux
- Fedora
- Microsoft Windows
### Chef
- Chef 12.1+
### Cookbooks
- build-essential
- xml
- mysql
- iis
- windows
These cookbooks are only used when building PHP from source.
Attributes
----------
## Attributes
- `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
* platform specific locations and settings.
* source installation settings
Resource/Provider
-----------------
## Resource/Provider
This cookbook includes LWRPs for managing:
- PEAR channels
- PEAR/PECL packages
### `php_pear_channel`
[PEAR Channels](http://pear.php.net/manual/en/guide.users.commandline.channels.php) are alternative sources for PEAR packages. This LWRP provides and easy way to manage these channels.
[PEAR Channels](http://pear.php.net/manual/en/guide.users.commandline.channels.php) are alternative sources for PEAR packages. This resource provides and easy way to manage these channels.
#### Actions
- :discover: Initialize a channel from its server.
@@ -52,8 +45,10 @@ This cookbook includes LWRPs for managing:
#### 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
- pear: pear binary, default: pear
#### Examples
```ruby
# discover the horde channel
php_pear_channel "pear.horde.org" do
@@ -85,20 +80,21 @@ end
[PEAR](http://pear.php.net/) is a framework and distribution system for reusable PHP components. [PECL](http://pecl.php.net/) 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.
#### Actions
- :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`
- `: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
- `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
- `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.
- o`ptions`: Add additional options to the underlying pear package command
#### Examples
```ruby
# upgrade a pear
php_pear "XML_RPC" do
@@ -156,35 +152,31 @@ 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).
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
More info: [http://php.net/manual/en/install.fpm.php](http://php.net/manual/en/install.fpm.php)
#### Actions
- :install: Installs the FPM pool (default).
- :uninstall: Removes the FPM pool.
- `: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: `/`
- `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](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: `/`
- `additional_config`: Additional parameters in JSON. Default: {}
#### Examples
```ruby
# Install a FPM pool named "default"
php_fpm_pool "default" do
@@ -192,8 +184,7 @@ php_fpm_pool "default" do
end
```
Recipes
-------
## Recipes
### default
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.
@@ -203,16 +194,15 @@ This recipe installs PHP from packages.
### source
This recipe installs PHP from source.
Deprecated Recipes
------------------
## Deprecated Recipes
The following recipes are deprecated and will be removed from a future version of this cookbook.
- `module_apc`
- `module_apcu`
- `module_curl`
- `module_fileinfo`
- `module_fpdf`
- `module_gd`
- `module_imap`
- `module_ldap`
- `module_memcache`
- `module_mysql`
@@ -233,10 +223,10 @@ php_pear "memcache" do
end
```
## Usage
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 or wrapper cookbook:
Usage
-----
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:
####Role example:
```ruby
name "php"
@@ -251,47 +241,12 @@ run_list(
)
```
## License & Authors
**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))
Development
-----------
This section details "quick development" steps. For a detailed explanation, see [[Contributing.md]].
1. Clone this repository from GitHub:
$ git clone git@github.com:opscode-cookbooks/php.git
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
-----------------
- Author:: Seth Chisamore (<schisamo@getchef.com>)
- Author:: Joshua Timberman (<joshua@getchef.com>)
- Author:: Julian C. Dunn (<jdunn@getchef.com>)
```text
Copyright:: 2013-2014, Chef Software, Inc.
**Copyright:** 2008-2017, 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.
You may obtain a copy of the License at
@@ -305,9 +260,7 @@ See the License for the specific language governing permissions and
limitations under the License.
```
Note: This cookbook contains a modified copy of `go-phar.pear` for use on the
Microsoft Windows platform only to correct an (upstream bug)[http://pear.php.net/bugs/bug.php?id=16644]. The original
`go-pear.phar` is licensed under the (PHP License version 2.02)[http://www.php.net/license/2_02.txt]:
Note: This cookbook contains a modified copy of `go-phar.pear` for use on the Microsoft Windows platform only to correct an (upstream bug)[[http://pear.php.net/bugs/bug.php?id=16644](http://pear.php.net/bugs/bug.php?id=16644)]. The original `go-pear.phar` is licensed under the (PHP License version 2.02)[[http://www.php.net/license/2_02.txt](http://www.php.net/license/2_02.txt)]:
```
--------------------------------------------------------------------

View File

@@ -1,9 +1,8 @@
#
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Attribute:: default
# Cookbook:: php
# Attributes:: default
#
# Copyright 2011-2014, Chef Software, Inc.
# Copyright:: 2011-2016, 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.
@@ -26,6 +25,26 @@ default['php']['bin'] = 'php'
default['php']['pear'] = 'pear'
default['php']['pecl'] = 'pecl'
default['php']['version'] = '5.6.13'
default['php']['url'] = 'http://us1.php.net/get'
default['php']['checksum'] = '92acc6c067f5e015a6881b4119eafec10eca11722e810f2c2083f72e17119bcf'
default['php']['prefix_dir'] = '/usr/local'
default['php']['enable_mod'] = '/usr/sbin/php5enmod'
default['php']['disable_mod'] = '/usr/sbin/php5dismod'
default['php']['ini']['template'] = 'php.ini.erb'
default['php']['ini']['cookbook'] = 'php'
default['php']['fpm_socket'] = '/var/run/php5-fpm.sock'
default['php']['curl']['package'] = 'php5-curl'
default['php']['apc']['package'] = 'php5-apc'
default['php']['apcu']['package'] = 'php5-apcu'
default['php']['gd']['package'] = 'php5-gd'
default['php']['ldap']['package'] = 'php5-ldap'
default['php']['pgsql']['package'] = 'php5-pgsql'
default['php']['sqlite']['package'] = 'php5-sqlite3'
case node['platform_family']
when 'rhel', 'fedora'
lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib'
@@ -33,35 +52,34 @@ when 'rhel', 'fedora'
default['php']['ext_conf_dir'] = '/etc/php.d'
default['php']['fpm_user'] = 'nobody'
default['php']['fpm_group'] = 'nobody'
default['php']['fpm_listen_user'] = 'nobody'
default['php']['fpm_listen_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']['mysql']['package'] = 'php53-mysql'
else
default['php']['packages'] = %w(php php-devel php-cli php-pear)
else # set fpm attributes as we're on a modern PHP release
default['php']['packages'] = if node['platform'] == 'amazon' # amazon names their packages with versions
%w(php56 php56-devel php-pear)
else # redhat does not name their packages with version on RHEL 6+
%w(php php-devel php-cli php-pear)
end
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'
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'
default['php']['fpm_listen_user'] = 'apache'
default['php']['fpm_listen_group'] = 'apache'
end
end
when 'debian'
default['php']['conf_dir'] = '/etc/php5/cli'
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']['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']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear)
default['php']['mysql']['package'] = 'php5-mysql'
@@ -69,20 +87,58 @@ when 'debian'
default['php']['fpm_pooldir'] = '/etc/php5/fpm/pool.d'
default['php']['fpm_user'] = 'www-data'
default['php']['fpm_group'] = 'www-data'
default['php']['fpm_service'] = 'php5-fpm'
default['php']['fpm_default_conf'] = '/etc/php5/fpm/pool.d/www.conf'
default['php']['fpm_listen_user'] = 'www-data'
default['php']['fpm_listen_group'] = 'www-data'
default['php']['fpm_service'] = 'php5-fpm'
default['php']['fpm_default_conf'] = '/etc/php5/fpm/pool.d/www.conf'
case node['platform']
when 'ubuntu'
case node['platform_version'].to_f
when 16.04
default['php']['version'] = '7.0.4'
default['php']['checksum'] = 'f6cdac2fd37da0ac0bbcee0187d74b3719c2f83973dfe883d5cde81c356fe0a8'
default['php']['conf_dir'] = '/etc/php/7.0/cli'
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 pkg-config)
default['php']['packages'] = %w(php7.0-cgi php7.0 php7.0-dev php7.0-cli php-pear)
default['php']['mysql']['package'] = 'php7.0-mysql'
default['php']['curl']['package'] = 'php7.0-curl'
default['php']['apc']['package'] = 'php-apc'
default['php']['apcu']['package'] = 'php-apcu'
default['php']['gd']['package'] = 'php7.0-gd'
default['php']['ldap']['package'] = 'php7.0-ldap'
default['php']['pgsql']['package'] = 'php7.0-pgsql'
default['php']['sqlite']['package'] = 'php7.0-sqlite3'
default['php']['fpm_package'] = 'php7.0-fpm'
default['php']['fpm_pooldir'] = '/etc/php/7.0/fpm/pool.d'
default['php']['fpm_service'] = 'php7.0-fpm'
default['php']['fpm_socket'] = '/var/run/php/php7.0-fpm.sock'
default['php']['fpm_default_conf'] = '/etc/php/7.0/fpm/pool.d/www.conf'
default['php']['enable_mod'] = '/usr/sbin/phpenmod'
default['php']['disable_mod'] = '/usr/sbin/phpdismod'
default['php']['ext_conf_dir'] = '/etc/php/7.0/mods-available'
when 13.04..15.10
default['php']['ext_conf_dir'] = '/etc/php5/mods-available'
end
when 'debian'
case node['platform_version'].to_i
when 8
default['php']['ext_conf_dir'] = '/etc/php5/mods-available'
end
end
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']['fpm_listen_user'] = 'wwwrun'
default['php']['fpm_listen_group'] = 'www'
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'
default['php']['windows']['msi_source'] = 'http://windows.php.net/downloads/releases/php-5.3.28-nts-Win32-VC9-x86.msi'
default['php']['windows']['msi_name'] = 'PHP 5.6.30'
default['php']['windows']['msi_source'] = 'http://windows.php.net/downloads/releases/php-5.6.30-nts-Win32-VC11-x86.msi'
default['php']['bin'] = 'php.exe'
default['php']['conf_dir'] = 'C:\Program Files (x86)\PHP'
default['php']['ext_conf_dir'] = node['php']['conf_dir']
@@ -105,7 +161,9 @@ when 'freebsd'
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']['fpm_listen_user'] = 'www'
default['php']['fpm_listen_group'] = 'www'
default['php']['packages'] = %w( php56 pear )
default['php']['mysql']['package'] = 'php56-mysqli'
else
default['php']['conf_dir'] = '/etc/php5/cli'
@@ -117,19 +175,14 @@ else
default['php']['mysql']['package'] = 'php5-mysql'
end
default['php']['url'] = 'http://us1.php.net/get'
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=#{node['php']['prefix_dir']}
--with-libdir=#{lib_dir}
--with-config-file-path=#{php['conf_dir']}
--with-config-file-scan-dir=#{php['ext_conf_dir']}
--with-config-file-path=#{node['php']['conf_dir']}
--with-config-file-scan-dir=#{node['php']['ext_conf_dir']}
--with-pear
--enable-fpm
--with-fpm-user=#{php['fpm_user']}
--with-fpm-group=#{php['fpm_group']}
--with-fpm-user=#{node['php']['fpm_user']}
--with-fpm-group=#{node['php']['fpm_group']}
--with-zlib
--with-openssl
--with-kerberos
@@ -159,6 +212,3 @@ default['php']['configure_options'] = %W(--prefix=#{php['prefix_dir']}
--with-sqlite3
--with-pdo-mysql
--with-pdo-sqlite)
default['php']['ini']['template'] = 'php.ini.erb'
default['php']['ini']['cookbook'] = 'php'

View File

@@ -1,9 +1,9 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Cookbook:: php
# Libraries:: helpers
#
# Copyright 2013, Opscode, Inc.
# Copyright:: 2013-2016, 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.

View File

@@ -16,6 +16,10 @@ if defined?(ChefSpec)
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :purge, resource_name)
end
def purge_php_pear(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :option, 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)
@@ -32,4 +36,13 @@ if defined?(ChefSpec)
def add_php_pear_channel(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :add, resource_name)
end
ChefSpec.define_matcher :php_fpm_pool
def install_php_fpm_pool(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:php_fpm_pool, :install, resource_name)
end
def uninstall_php_fpm_pool(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:php_fpm_pool, :uninstall, resource_name)
end
end

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
#
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
# Cookbook Name:: php
# Cookbook:: php
# Provider:: fpm_pool
#
# Copyright:: 2015, Opscode, Inc <legal@opscode.com>
# Copyright:: 2015-2016, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,8 @@
# limitations under the License.
#
use_inline_resources
def whyrun_supported?
true
end
@@ -28,16 +30,15 @@ def install_fpm_package
# 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
raise 'PHP-FPM package not found (you probably have an unsupported distro)' if node['php']['fpm_package'].nil?
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']}]", :immediately
end
end
@@ -57,20 +58,22 @@ action :install 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']}]"
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_listen_user: new_resource.listen_user,
fpm_pool_listen_group: new_resource.listen_group,
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_service']}]"
end
new_resource.updated_by_last_action(t.updated_by_last_action?)
end
@@ -79,7 +82,7 @@ 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
f = file "#{node['php']['fpm_pooldir']}/#{new_resource.pool_name}.conf" do
action :delete
end
new_resource.updated_by_last_action(f.updated_by_last_action?)

View File

@@ -1,9 +1,9 @@
#
# Author:: Seth Chisamore <schisamo@getchef.com>
# Cookbook Name:: php
# Author:: Seth Chisamore <schisamo@chef.io>
# Cookbook:: php
# Provider:: pear_package
#
# Copyright:: 2011, Opscode, Inc <legal@getchef.com>
# Copyright:: 2011-2016, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,8 @@
# limitations under the License.
#
use_inline_resources
require 'chef/mixin/shell_out'
require 'chef/mixin/language'
include Chef::Mixin::ShellOut
@@ -26,6 +28,8 @@ include Chef::Mixin::ShellOut
# the Chef::Provider::Package which will make
# refactoring into core chef easy
use_inline_resources
def whyrun_supported?
true
end
@@ -41,7 +45,7 @@ action :install do
info_output = "Installing #{@new_resource}"
info_output << " version #{install_version}" if install_version && !install_version.empty?
Chef::Log.info(info_output)
status = install_package(@new_resource.package_name, install_version)
install_package(@new_resource.package_name, install_version)
end
end
end
@@ -52,7 +56,7 @@ action :upgrade do
description = "upgrade package #{@new_resource} version from #{orig_version} to #{candidate_version}"
converge_by(description) do
Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{candidate_version}")
status = upgrade_package(@new_resource.package_name, candidate_version)
upgrade_package(@new_resource.package_name, candidate_version)
end
end
end
@@ -172,14 +176,14 @@ def remove_package(name, version)
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') }
execute "#{node['php']['enable_mod']} #{name}" do
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?(node['php']['enable_mod']) }
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') }
execute "#{node['php']['disable_mod']} #{name}" do
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?(node['php']['disable_mod']) }
end
end
@@ -202,7 +206,7 @@ def prefix_channel(channel)
channel ? "#{channel}/" : ''
end
def get_extension_dir
def extension_dir
@extension_dir ||= begin
# Consider using "pecl config-get ext_dir". It is more cross-platform.
# p = shell_out("php-config --extension-dir")
@@ -223,7 +227,7 @@ def get_extension_files(name)
end
def manage_pecl_ini(name, action, directives, zend_extensions)
ext_prefix = get_extension_dir
ext_prefix = extension_dir
ext_prefix << ::File::SEPARATOR if ext_prefix[-1].chr != ::File::SEPARATOR
files = get_extension_files(name)
@@ -237,7 +241,7 @@ def manage_pecl_ini(name, action, directives, zend_extensions)
end
]
directory "#{node['php']['ext_conf_dir']}" do
directory node['php']['ext_conf_dir'] do
owner 'root'
group 'root'
mode '0755'
@@ -250,7 +254,7 @@ def manage_pecl_ini(name, action, directives, zend_extensions)
owner 'root'
group 'root'
mode '0644'
variables(:name => name, :extensions => extensions, :directives => directives)
variables(name: name, extensions: extensions, directives: directives)
action action
end
end
@@ -264,13 +268,13 @@ def grep_for_version(stdout, package)
# Horde_Url -n/a-/(1.0.0beta1 beta) Horde Url class
# Horde_Url 1.0.0beta1 (beta) 1.0.0beta1 Horde Url class
v = m.split(/\s+/)[1].strip
if v.split(/\//)[0] =~ /.\./
# 1.1.4/(1.1.4 stable)
v = v.split(/\//)[0]
else
# -n/a-/(1.0.0beta1 beta)
v = v.split(/(.*)\/\((.*)/).last.split(/\s/)[0]
end
v = if v.split(%r{/\//})[0] =~ /.\./
# 1.1.4/(1.1.4 stable)
v.split(%r{/\//})[0]
else
# -n/a-/(1.0.0beta1 beta)
v.split(%r{/(.*)\/\((.*)/}).last.split(/\s/)[0]
end
end
v
end
@@ -288,7 +292,7 @@ def pecl?
elsif grep_for_version(shell_out(node['php']['pecl'] + search_args).stdout, @new_resource.package_name)
true
else
fail "Package #{@new_resource.package_name} not found in either PEAR or PECL."
raise "Package #{@new_resource.package_name} not found in either PEAR or PECL."
end
end
end

View File

@@ -1,91 +0,0 @@
#
# Author:: Seth Chisamore <schisamo@getchef.com>
# Cookbook Name:: php
# Provider:: pear_channel
#
# 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.
# 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.
#
# http://pear.php.net/manual/en/guide.users.commandline.channels.php
require 'chef/mixin/shell_out'
require 'chef/mixin/language'
include Chef::Mixin::ShellOut
def whyrun_supported?
true
end
action :discover do
unless exists?
Chef::Log.info("Discovering pear channel #{@new_resource}")
execute "#{node['php']['pear']} channel-discover #{@new_resource.channel_name}" do
action :run
end
end
end
action :add do
unless exists?
Chef::Log.info("Adding pear channel #{@new_resource} from #{@new_resource.channel_xml}")
execute "#{node['php']['pear']} channel-add #{@new_resource.channel_xml}" do
action :run
end
end
end
action :update do
if exists?
update_needed = false
begin
updated_needed = true if shell_out("#{node['php']['pear']} search -c #{@new_resource.channel_name} NNNNNN").stdout =~ /channel-update/
rescue Chef::Exceptions::CommandTimeout
# CentOS can hang on 'pear search' if a channel needs updating
Chef::Log.info("Timed out checking if channel-update needed...forcing update of pear channel #{@new_resource}")
update_needed = true
end
if update_needed
description = "update pear channel #{@new_resource}"
converge_by(description) do
Chef::Log.info("Updating pear channel #{@new_resource}")
shell_out!("#{node['php']['pear']} channel-update #{@new_resource.channel_name}")
end
end
end
end
action :remove do
if exists?
Chef::Log.info("Deleting pear channel #{@new_resource}")
execute "#{node['php']['pear']} channel-delete #{@new_resource.channel_name}" do
action :run
end
end
end
def load_current_resource
@current_resource = Chef::Resource::PhpPearChannel.new(@new_resource.name)
@current_resource.channel_name(@new_resource.channel_name)
@current_resource
end
private
def exists?
shell_out!("#{node['php']['pear']} channel-info #{@current_resource.channel_name}")
true
rescue Mixlib::ShellOut::ShellCommandFailed
false
end

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: default
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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.

View File

@@ -1,9 +1,9 @@
#
# Author:: Christo De Lange (<opscode@dldinternet.com>)
# Cookbook Name:: php
# Cookbook:: php
# Recipe:: ini
#
# Copyright 2011-2014, Chef Software, Inc.
# Copyright:: 2011-2016, 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.
@@ -26,5 +26,5 @@ template "#{node['php']['conf_dir']}/php.ini" do
group node['root_group']
mode '0644'
end
variables(:directives => node['php']['directives'])
variables(directives: node['php']['directives'])
end

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_apc
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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,17 +21,12 @@
case node['platform_family']
when 'rhel', 'fedora'
%w(httpd-devel pcre pcre-devel).each do |pkg|
package pkg do
action :install
end
end
package %w(httpd-devel pcre pcre-devel)
php_pear 'APC' do
action :install
directives(:shm_size => '128M', :enable_cli => 0)
directives(shm_size: '128M', enable_cli: 0)
end
when 'debian'
package 'php-apc' do
action :install
end
package node['php']['apc']['package']
end

View File

@@ -0,0 +1,32 @@
#
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_apc
#
# Copyright:: 2009-2016, 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.
# 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.
#
case node['platform_family']
when 'rhel', 'fedora'
package %w(httpd-devel pcre pcre-devel)
php_pear 'APCu' do
action :install
directives(shm_size: '128M', enable_cli: 0)
end
when 'debian'
package node['php']['apcu']['package']
end

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_curl
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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,11 +19,7 @@
# limitations under the License.
#
case node['platform_family']
when 'rhel', 'fedora'
# centos php compiled with curl
when 'debian'
package 'php5-curl' do
action :upgrade
end
package node['php']['curl']['package'] do
action :install
only_if { platform_family?('debian') } # centos php compiled with curl
end

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_fpdf
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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.

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_gd
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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,12 +22,12 @@
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-gd',
'default' => 'php-gd'
'default' => 'php-gd',
},
'freebsd' => {
'default' => 'php56-gd'
'default' => 'php56-gd',
},
'default' => 'php5-gd'
'default' => node['php']['gd']['package']
)
package pkg do

View File

@@ -0,0 +1,29 @@
#
# Author:: Artur Melo (<artur.melo@beubi.com>)
# Cookbook:: php
# Recipe:: module_imap
#
# 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.
#
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-imap',
'default' => 'php-imap',
},
'default' => 'php5-imap'
)
package pkg do
action :install
end

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_ldap
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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,9 +22,9 @@
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-ldap',
'default' => 'php-ldap'
'default' => 'php-ldap',
},
'default' => 'php5-ldap'
'default' => node['php']['ldap']['package']
)
package pkg do

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_memcache
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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,17 +21,11 @@
case node['platform_family']
when 'rhel', 'fedora'
%w(zlib-devel).each do |pkg|
package pkg do
action :install
end
end
package 'zlib-devel'
php_pear 'memcache' do
action :install
# directives(:shm_size => "128M", :enable_cli => 0)
end
when 'debian'
package 'php5-memcache' do
action :install
end
package 'php5-memcache'
end

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_mysql
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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.

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_pgsql
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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,9 +22,9 @@
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-pgsql',
'default' => 'php-pgsql'
'default' => 'php-pgsql',
},
'default' => 'php5-pgsql'
'default' => node['php']['pgsql']['package']
)
package pkg do

View File

@@ -1,10 +1,10 @@
#
# Author:: Joshua Timberman (<joshua@getchef.com>)
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Author:: Joshua Timberman (<joshua@chef.io>)
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: module_sqlite3
#
# Copyright 2009-2014, Chef Software, Inc.
# Copyright:: 2009-2016, 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,11 +19,7 @@
# limitations under the License.
#
case node['platform_family']
when 'rhel', 'fedora'
# already there in centos, --with-pdo-sqlite=shared
when 'debian'
package 'php5-sqlite' do
action :install
end
package node['php']['sqlite']['package'] do
action :install
only_if { platform_family?('debian') } # already there in centos, --with-pdo-sqlite=shared
end

View File

@@ -1,10 +1,10 @@
#
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Author:: Lucas Hansen (<lucash@getchef.com>)
# Cookbook Name:: php
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Author:: Lucas Hansen (<lucash@chef.io>)
# Cookbook:: php
# Recipe:: package
#
# Copyright 2013-2014, Chef Software, Inc.
# Copyright:: 2013-2016, 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.
@@ -23,7 +23,7 @@ if platform?('windows')
include_recipe 'iis::mod_cgi'
install_dir = File.expand_path(node['php']['conf_dir']).gsub('/', '\\')
install_dir = File.expand_path(node['php']['conf_dir']).tr('/', '\\')
windows_package node['php']['windows']['msi_name'] do
source node['php']['windows']['msi_source']
installer_type :msi

View File

@@ -1,9 +1,9 @@
#
# Author:: David Kinzer (<dtkinzer@gmail.com>)
# Cookbook Name:: php
# Cookbook:: php
# Recipe:: recompile
#
# Copyright 2014, David Kinzer
# Copyright:: 2014-2016, David Kinzer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ 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}"
creates "#{Chef::Config[:file_cache_path]}/php-#{version}"
end
bash 're-build php' do
@@ -46,6 +46,6 @@ bash 're-build php' do
code <<-EOF
(make clean)
(#{ext_dir_prefix} ./configure #{configure_options})
(make && make install)
(make -j #{node['cpu']['total']} && make install)
EOF
end

View File

@@ -1,9 +1,9 @@
#
# Author:: Seth Chisamore (<schisamo@getchef.com>)
# Cookbook Name:: php
# Recipe:: package
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook:: php
# Recipe:: source
#
# Copyright 2011-2014, Chef Software, Inc.
# Copyright:: 2011-2016, 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.
@@ -29,11 +29,7 @@ mysql_client 'default' do
only_if { configure_options =~ /mysql/ }
end
node['php']['src_deps'].each do |pkg|
package pkg do
action :install
end
end
package node['php']['src_deps']
version = node['php']['version']
@@ -41,7 +37,7 @@ 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'
not_if "which #{node['php']['bin']}"
not_if "$(which #{node['php']['bin']}) --version | grep #{version}"
end
if node['php']['ext_dir']
@@ -56,14 +52,21 @@ else
ext_dir_prefix = ''
end
# PHP is unable to find the GMP library in 16.04. The symlink brings the file
# inside of the include libraries.
link '/usr/include/gmp.h' do
to '/usr/include/x86_64-linux-gnu/gmp.h'
only_if { node['platform_family'] == 'debian' && node['platform_version'].to_f >= 14.04 }
end
bash 'build php' do
cwd Chef::Config[:file_cache_path]
code <<-EOF
tar -zxf php-#{version}.tar.gz
(cd php-#{version} && #{ext_dir_prefix} ./configure #{configure_options})
(cd php-#{version} && make && make install)
(cd php-#{version} && make -j #{node['cpu']['total']} && make install)
EOF
not_if "which #{node['php']['bin']}"
not_if "$(which #{node['php']['bin']}) --version | grep #{version}"
end
directory node['php']['conf_dir'] do

View File

@@ -1,9 +1,9 @@
#
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
# Cookbook Name:: php
# Cookbook:: php
# Resource:: fpm_pool
#
# Copyright:: 2015, Opscode, Inc <legal@opscode.com>
# Copyright:: 2015-2016, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,14 +21,16 @@
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 => {}
attribute :pool_name, kind_of: String, name_attribute: true
attribute :listen, kind_of: String, default: node['php']['fpm_socket']
attribute :user, kind_of: String, default: node['php']['fpm_user']
attribute :group, kind_of: String, default: node['php']['fpm_group']
attribute :listen_user, kind_of: String, default: node['php']['fpm_listen_user']
attribute :listen_group, kind_of: String, default: node['php']['fpm_listen_group']
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: {}

View File

@@ -1,9 +1,9 @@
#
# Author:: Seth Chisamore <schisamo@getchef.com>
# Cookbook Name:: php
# Author:: Seth Chisamore <schisamo@chef.io>
# Cookbook:: php
# Resource:: pear_package
#
# Copyright:: 2011-2014, Chef Software, Inc <legal@getchef.com>
# Copyright:: 2011-2016, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,10 +29,10 @@ state_attrs :channel,
:version,
:zend_extensions
attribute :package_name, :kind_of => String, :name_attribute => true
attribute :version, :default => nil
attribute :channel, :kind_of => String
attribute :options, :kind_of => String
attribute :directives, :kind_of => Hash, :default => {}
attribute :zend_extensions, :kind_of => Array, :default => []
attribute :preferred_state, :default => 'stable'
attribute :package_name, kind_of: String, name_attribute: true
attribute :version, default: nil
attribute :channel, kind_of: String
attribute :options, kind_of: String
attribute :directives, kind_of: Hash, default: {}
attribute :zend_extensions, kind_of: Array, default: []
attribute :preferred_state, default: 'stable'

View File

@@ -1,9 +1,10 @@
#
# Author:: Seth Chisamore <schisamo@getchef.com>
# Cookbook Name:: php
# Author:: Seth Chisamore <schisamo@chef.io>
# Author:: Jennifer Davis <sigje@chef.io>
# Cookbook:: php
# Resource:: pear_channel
#
# Copyright:: 2011-2014, Chef Software, Inc <legal@getchef.com>
# Copyright:: 2011-2017, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,14 +20,65 @@
#
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
property :channel_xml, kind_of: String
property :channel_name, kind_of: String, name_property: true
property :pear, kind_of: String, default: 'pear'
# TODO: add authenticated channel support!
# attribute :username, :kind_of => String
# attribute :password, :kind_of => String
# property :username, :kind_of => String
# property :password, :kind_of => String
action_class do
def exists?
shell_out!("#{@new_resource.pear} channel-info #{@new_resource.channel_name}")
true
rescue Mixlib::ShellOut::ShellCommandFailed
false
end
end
action :discover do
unless exists?
Chef::Log.info("Discovering pear channel #{@new_resource}")
execute "#{@new_resource.pear} channel-discover #{@new_resource.channel_name}" do
action :run
end
end
end
action :add do
unless exists?
Chef::Log.info("Adding pear channel #{@new_resource} from #{@new_resource.channel_xml}")
execute "#{@new_resource.pear} channel-add #{@new_resource.channel_xml}" do
action :run
end
end
end
action :update do
if exists?
update_needed = false
begin
update_needed = true if shell_out("#{@new_resource.pear} search -c #{@new_resource.channel_name} NNNNNN").stdout =~ /channel-update/
rescue Chef::Exceptions::CommandTimeout
# CentOS can hang on 'pear search' if a channel needs updating
Chef::Log.info("Timed out checking if channel-update needed...forcing update of pear channel #{@new_resource}")
update_needed = true
end
if update_needed
description = "update pear channel #{@new_resource}"
converge_by(description) do
Chef::Log.info("Updating pear channel #{@new_resource}")
shell_out!("#{@new_resource.pear} channel-update #{@new_resource.channel_name}")
end
end
end
end
action :remove do
if exists?
Chef::Log.info("Deleting pear channel #{@new_resource}")
execute "#{@new_resource.pear} channel-delete #{@new_resource.channel_name}" do
action :run
end
end
end

View File

@@ -2,8 +2,8 @@
user = <%= @fpm_pool_user %>
group = <%= @fpm_pool_group %>
listen = <%= @fpm_pool_listen %>
listen.owner = <%= @fpm_pool_user %>
listen.group = <%= @fpm_pool_group %>
listen.owner = <%= @fpm_pool_listen_user %>
listen.group = <%= @fpm_pool_listen_group %>
pm = <%= @fpm_pool_manager %>
pm.max_children = <%= @fpm_pool_max_children %>
pm.start_servers = <%= @fpm_pool_start_servers %>