Update more cookbooks

This commit is contained in:
Greg Karékinian
2017-06-16 11:25:49 +02:00
parent 7da2c5a738
commit f5858319a7
129 changed files with 1095 additions and 101571 deletions

View File

@@ -2,7 +2,42 @@
This file is used to list changes made in each version of the php cookbook.
## 4.2.0 (2017-05-30)
- Make sure package intalls, php-fpm, and source installs work on Amazon linux
- Avoid symlink warning in the converges
- Simplify the package install logic
- Rename the inspec test to match the suite name so it actually runs
- Test on FreeBSD 11 / Amazon Linux
- Install 5.6.30 by default on source installs
## 4.1.0 (2017-05-30)
- Remove class_eval usage and require Chef 12.7+
## 4.0.0 (2017-04-20)
- Fix pear_channel resource to not fail on Chef 12.5 and 12.6
- Remove support for RHEL 5 as it is now EOL
- Resolve Amazon Linux failures on Chef 13
- Convert fpm_pool to a custom resource
- Fix php_pear failures on Chef 13
- Remove non-functional support for Windows
- Remove redundant Ubuntu version checks in the php_pear provider
- Expand testing to test all of the resources
## 3.1.1 (2017-04-20)
- Use the cookbook attribute as the default value of pear_channel pear property to provide better platform support
## 3.1.0 (2017-04-10)
- Use multi-package installs on supported platform_family(rhel debian suse amazon)
- Use a SPDX standardized license string in the metadata
- Update specs for the new Fauxhai data
## 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
@@ -10,7 +45,8 @@ This file is used to list changes made in each version of the php cookbook.
- 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.
**NOTE** Windows package installation is currently broken.
## 2.2.1 (2017-02-21)

View File

@@ -1,48 +1,58 @@
# 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)
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.
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.
## Requirements
### Platforms
- Debian, Ubuntu
- CentOS, Red Hat, Oracle, Scientific, Amazon Linux
- Fedora
- Microsoft Windows
### Chef
- Chef 12.1+
- Chef 12.7+
### Cookbooks
- build-essential
- xml
- mysql
- iis
- windows
## 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 `{}`.
- `node['php']['pear']` = Name of the pear executable to use, default `pear`.
The file also contains the following attribute types:
- platform specific locations and settings.
- source installation settings
## 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 resource 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.
- :add: Add a channel to the channel list, usually only used to add private channels. Public channels are usually added using the `:discover` action
- :add: Add a channel to the channel list, usually only used to add private channels. Public channels are usually added using the `:discover` action
- :update: Update an existing channel
- :remove: Remove a channel from the List
#### Attribute Parameters
- channel_name: name attribute. The name of the channel to discover
- channel_xml: the channel.xml file of the channel you are adding
- pear: pear binary, default: pear
@@ -77,17 +87,20 @@ end
```
### `php_pear`
[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.
[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`
- `:purge`: Purge a pear package (this usually entails removing configuration files as well as the package itself). With pear packages this behaves the same as `:remove`
#### Attribute Parameters
- `package_name`: name attribute. The name of the pear package to install
- version: the version of the pear package to install/upgrade. If no version is given latest is assumed.
- 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.
@@ -152,22 +165,25 @@ 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](http://php.net/manual/en/install.fpm.php)
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](http://php.net/manual/en/install.fpm.configuration.php). Default: `dynamic`
- `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
@@ -185,17 +201,23 @@ end
```
## 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.
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.
### package
This recipe installs PHP from packages.
### source
This recipe installs PHP from source.
## Deprecated Recipes
The following recipes are deprecated and will be removed from a future version of this cookbook.
- `module_apc`
- `module_apcu`
- `module_curl`
@@ -209,7 +231,7 @@ The following recipes are deprecated and will be removed from a future version o
- `module_pgsql`
- `module_sqlite3`
The installation of the php modules in these recipes can now be accomplished by installing from a native package or via the new php_pear LWRP. For example, the functionality of the `module_memcache` recipe can be enabled in the following ways:
The installation of the php modules in these recipes can now be accomplished by installing from a native package or via the new php_pear LWRP. For example, the functionality of the `module_memcache` recipe can be enabled in the following ways:
```ruby
# using apt
@@ -224,9 +246,10 @@ 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:
####Role example:
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:
### Role example:
```ruby
name "php"
@@ -242,6 +265,7 @@ run_list(
```
## License & Authors
**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))
**Copyright:** 2008-2017, Chef Software, Inc.
@@ -259,83 +283,3 @@ 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.
```
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)]:
```
--------------------------------------------------------------------
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
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
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.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the
terms of that version. You may also choose to use such covered
code under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
5. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP, freely available from
http://www.php.net/".
6. The software incorporates the Zend Engine, a product of Zend
Technologies, Ltd. ("Zend"). The Zend Engine is licensed to the
PHP Association (pursuant to a grant from Zend that can be
found at http://www.php.net/license/ZendGrant/) for
distribution to you under this license agreement, only as a
part of PHP. In the event that you separate the Zend Engine
(or any portion thereof) from the rest of the software, or
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/.
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
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
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,
please see <http://www.php.net>.
```

View File

@@ -2,7 +2,7 @@
# Cookbook:: php
# Attributes:: default
#
# Copyright:: 2011-2016, Chef Software, Inc.
# Copyright:: 2011-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.
@@ -25,10 +25,10 @@ default['php']['bin'] = 'php'
default['php']['pear'] = 'pear'
default['php']['pecl'] = 'pecl'
default['php']['version'] = '5.6.13'
default['php']['version'] = '5.6.30'
default['php']['url'] = 'http://us1.php.net/get'
default['php']['checksum'] = '92acc6c067f5e015a6881b4119eafec10eca11722e810f2c2083f72e17119bcf'
default['php']['checksum'] = '8bc7d93e4c840df11e3d9855dcad15c1b7134e8acf0cf3b90b932baea2d0bde2'
default['php']['prefix_dir'] = '/usr/local'
default['php']['enable_mod'] = '/usr/sbin/php5enmod'
default['php']['disable_mod'] = '/usr/sbin/php5dismod'
@@ -46,7 +46,7 @@ default['php']['pgsql']['package'] = 'php5-pgsql'
default['php']['sqlite']['package'] = 'php5-sqlite3'
case node['platform_family']
when 'rhel', 'fedora'
when 'rhel', 'fedora', 'amazon'
lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib'
default['php']['conf_dir'] = '/etc'
default['php']['ext_conf_dir'] = '/etc/php.d'
@@ -54,28 +54,25 @@ when 'rhel', 'fedora'
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 # 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']['ext_dir'] = "/usr/#{lib_dir}/php/modules"
if node['platform'] == 'amazon' # amazon names their packages with versions
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)
default['php']['packages'] = %w(php56 php56-devel php-pear)
default['php']['fpm_package'] = 'php56-fpm'
else # redhat does not name their packages with version on RHEL 6+
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)
default['php']['packages'] = %w(php php-devel php-cli php-pear)
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'
default['php']['fpm_listen_user'] = 'apache'
default['php']['fpm_listen_group'] = 'apache'
end
end
default['php']['mysql']['package'] = 'php-mysql'
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'
default['php']['fpm_listen_user'] = 'apache'
default['php']['fpm_listen_group'] = 'apache'
end
when 'debian'
default['php']['conf_dir'] = '/etc/php5/cli'
@@ -120,8 +117,7 @@ when 'debian'
default['php']['ext_conf_dir'] = '/etc/php5/mods-available'
end
when 'debian'
case node['platform_version'].to_i
when 8
if node['platform_version'].to_i == 8
default['php']['ext_conf_dir'] = '/etc/php5/mods-available'
end
end
@@ -136,25 +132,6 @@ when 'suse'
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.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']
# 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']['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'

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +0,0 @@
#
# Author:: Joshua Timberman (<joshua@chef.io>)
# Cookbook:: php
# Libraries:: helpers
#
# 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.
# 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 el5_range
(0..99).to_a.map { |i| "5.#{i}" }
end

File diff suppressed because one or more lines are too long

View File

@@ -1,89 +0,0 @@
#
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
# Cookbook:: php
# Provider:: fpm_pool
#
# 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.
# 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.
#
use_inline_resources
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'
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
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_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
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}.conf" do
action :delete
end
new_resource.updated_by_last_action(f.updated_by_last_action?)
end

View File

@@ -3,7 +3,7 @@
# Cookbook:: php
# Provider:: pear_package
#
# Copyright:: 2011-2016, Chef Software, Inc <legal@chef.io>
# 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.
@@ -102,7 +102,7 @@ end
# so refactoring into core Chef should be easy
def load_current_resource
@current_resource = Chef::Resource::PhpPear.new(@new_resource.name)
@current_resource = new_resource.class.new(new_resource.name)
@current_resource.package_name(@new_resource.package_name)
@bin = node['php']['pear']
if pecl?
@@ -177,13 +177,13 @@ end
def enable_package(name)
execute "#{node['php']['enable_mod']} #{name}" do
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?(node['php']['enable_mod']) }
only_if { platform?('ubuntu') && ::File.exist?(node['php']['enable_mod']) }
end
end
def disable_package(name)
execute "#{node['php']['disable_mod']} #{name}" do
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?(node['php']['disable_mod']) }
only_if { platform?('ubuntu') && ::File.exist?(node['php']['disable_mod']) }
end
end

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: default
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.

View File

@@ -3,7 +3,7 @@
# Cookbook:: php
# Recipe:: ini
#
# Copyright:: 2011-2016, Chef Software, Inc.
# Copyright:: 2011-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.
@@ -21,10 +21,9 @@
template "#{node['php']['conf_dir']}/php.ini" do
source node['php']['ini']['template']
cookbook node['php']['ini']['cookbook']
unless platform?('windows')
owner 'root'
group node['root_group']
mode '0644'
end
owner 'root'
group node['root_group']
mode '0644'
manage_symlink_source true
variables(directives: node['php']['directives'])
end

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_apc
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.
@@ -20,7 +20,7 @@
#
case node['platform_family']
when 'rhel', 'fedora'
when 'rhel', 'fedora', 'amazon'
package %w(httpd-devel pcre pcre-devel)
php_pear 'APC' do

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_apc
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.
@@ -20,7 +20,7 @@
#
case node['platform_family']
when 'rhel', 'fedora'
when 'rhel', 'fedora', 'amazon'
package %w(httpd-devel pcre pcre-devel)
php_pear 'APCu' do

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_curl
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_fpdf
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.
@@ -20,7 +20,7 @@
#
case node['platform_family']
when 'rhel', 'fedora'
when 'rhel', 'fedora', 'amazon'
pearhub_chan = php_pear_channel 'pearhub.org' do
action :discover
end

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_gd
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.
@@ -21,7 +21,6 @@
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-gd',
'default' => 'php-gd',
},
'freebsd' => {

View File

@@ -18,7 +18,6 @@
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-imap',
'default' => 'php-imap',
},
'default' => 'php5-imap'

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_ldap
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.
@@ -21,7 +21,6 @@
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-ldap',
'default' => 'php-ldap',
},
'default' => node['php']['ldap']['package']

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_memcache
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.
@@ -20,7 +20,7 @@
#
case node['platform_family']
when 'rhel', 'fedora'
when 'rhel', 'fedora', 'amazon'
package 'zlib-devel'
php_pear 'memcache' do

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_mysql
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_pgsql
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.
@@ -21,7 +21,6 @@
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-pgsql',
'default' => 'php-pgsql',
},
'default' => node['php']['pgsql']['package']

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: module_sqlite3
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2009-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.

View File

@@ -4,7 +4,7 @@
# Cookbook:: php
# Recipe:: package
#
# Copyright:: 2013-2016, Chef Software, Inc.
# Copyright:: 2013-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.
@@ -19,45 +19,13 @@
# limitations under the License.
#
if platform?('windows')
include_recipe 'iis::mod_cgi'
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
options %W(
/quiet
INSTALLDIR="#{install_dir}"
ADDLOCAL=#{node['php']['packages'].join(',')}
).join(' ')
if platform_family?('rhel', 'debian', 'amazon', 'suse')
package node['php']['packages'] do
options node['php']['package_options']
end
# WARNING: This is not the out-of-the-box go-pear.phar. It's been modified to patch this bug:
# http://pear.php.net/bugs/bug.php?id=16644
cookbook_file "#{node['php']['conf_dir']}/PEAR/go-pear.phar" do
source 'go-pear.phar'
end
template "#{node['php']['conf_dir']}/pear-options" do
source 'pear-options.erb'
end
execute 'install-pear' do
cwd node['php']['conf_dir']
command 'go-pear.bat < pear-options'
creates "#{node['php']['conf_dir']}/pear.bat"
end
ENV['PATH'] += ";#{install_dir}"
windows_path install_dir
else
node['php']['packages'].each do |pkg|
package pkg do
action :install
options node['php']['package_options']
end
end

View File

@@ -3,7 +3,7 @@
# Cookbook:: php
# Recipe:: recompile
#
# Copyright:: 2014-2016, David Kinzer
# Copyright:: 2014-2017, David Kinzer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -3,7 +3,7 @@
# Cookbook:: php
# Recipe:: source
#
# Copyright:: 2011-2016, Chef Software, Inc.
# Copyright:: 2011-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.

View File

@@ -3,7 +3,7 @@
# Cookbook:: php
# Resource:: fpm_pool
#
# Copyright:: 2015-2016, Chef Software, Inc <legal@chef.io>
# Copyright:: 2015-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.
@@ -18,19 +18,80 @@
# limitations under the License.
#
default_action :install
actions :install, :uninstall
property :pool_name, String, name_property: true
property :listen, String, default: lazy { node['php']['fpm_socket'] }
property :user, String, default: lazy { node['php']['fpm_user'] }
property :group, String, default: lazy { node['php']['fpm_group'] }
property :listen_user, String, default: lazy { node['php']['fpm_listen_user'] }
property :listen_group, String, default: lazy { node['php']['fpm_listen_group'] }
property :process_manager, String, default: 'dynamic'
property :max_children, Integer, default: 5
property :start_servers, Integer, default: 2
property :min_spare_servers, Integer, default: 1
property :max_spare_servers, Integer, default: 3
property :chdir, String, default: '/'
property :additional_config, 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: {}
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?
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_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
end
action :uninstall do
# Ensure the FPM pacakge is installed, and the service is registered
register_fpm_service
# Delete the FPM pool.
file "#{node['php']['fpm_pooldir']}/#{new_resource.pool_name}.conf" do
action :delete
end
end
action_class do
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'
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
def register_fpm_service
service node['php']['fpm_service'] do
action :enable
end
end
end

View File

@@ -19,27 +19,17 @@
# limitations under the License.
#
default_action :discover
property :channel_xml, kind_of: String
property :channel_name, kind_of: String, name_property: true
property :pear, kind_of: String, default: 'pear'
property :pear, kind_of: String, default: lazy { node['php']['pear'] }
# TODO: add authenticated channel support!
# 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
Chef::Log.info("Discovering pear channel #{new_resource}")
execute "#{new_resource.pear} channel-discover #{new_resource.channel_name}" do
action :run
end
end
@@ -47,8 +37,8 @@ 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
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
@@ -58,17 +48,17 @@ 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/
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}")
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}"
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}")
Chef::Log.info("Updating pear channel #{new_resource}")
shell_out!("#{new_resource.pear} channel-update #{new_resource.channel_name}")
end
end
end
@@ -76,9 +66,18 @@ 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
Chef::Log.info("Deleting pear channel #{new_resource}")
execute "#{new_resource.pear} channel-delete #{new_resource.channel_name}" do
action :run
end
end
end
action_class do
def exists?
shell_out!("#{new_resource.pear} channel-info #{new_resource.channel_name}")
true
rescue Mixlib::ShellOut::ShellCommandFailed
false
end
end

View File

@@ -1,18 +0,0 @@
all
<%= node['php']['conf_dir'].gsub("/", "\\") %>
n

File diff suppressed because it is too large Load Diff