Do not vendor cookbooks using Berkshelf anymore
Instead, use the Berkshelf support in knife-solo and the vagrant-berkshelf plugin on Vagrant
This commit is contained in:
@@ -1,273 +0,0 @@
|
||||
# php Cookbook CHANGELOG
|
||||
|
||||
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
|
||||
- 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)
|
||||
|
||||
- Correct permissions on ext_conf_dir folder (644 -> 755)
|
||||
|
||||
## v1.7.0 (2015-7-31)
|
||||
|
||||
- NOTICE - This version changes the way the ['php']['directives'] is placed into configuration files. Quotes are no longer automatically placed around these aditional directives. Please take care when rolling out this version.
|
||||
- Allow additional PHP FPM config
|
||||
- Add recipe to recompile PHP from source
|
||||
- Move source dependencies to attributes file
|
||||
- Misc bug fixes
|
||||
|
||||
## v1.6.0 (2015-7-6)
|
||||
|
||||
- Added ChefSpec matchers
|
||||
- Added basic PHP-FPM Support (Pre-Release)
|
||||
- Added support for FreeBSD
|
||||
- Updated cookbook to use MySQL 6.0 cookbook
|
||||
- Update cookbook to use php5enmod on supported platforms
|
||||
- Allow users to override php-mysql package
|
||||
|
||||
## v1.5.0 (2014-10-06)
|
||||
|
||||
- Adding package_options attribute, utilizing in package resource
|
||||
|
||||
## 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)
|
||||
|
||||
- [COOK-4393] - Fix convergence bug in source install
|
||||
|
||||
## v1.4.2 (2014-02-27)
|
||||
|
||||
[COOK-4300] - Simplified and fixed pear/pecl logic. [Fixes #56 / #57]
|
||||
|
||||
## v1.4.0 (2014-02-27)
|
||||
|
||||
[COOK-3639] - Allow users to specify php.ini source template
|
||||
|
||||
## 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)
|
||||
|
||||
Fix github issue 'Cannot find a resource for preferred_state'
|
||||
|
||||
## v1.3.10
|
||||
|
||||
Fixing my stove
|
||||
|
||||
## v1.3.8
|
||||
|
||||
Version bump to ensure artifact sanity
|
||||
|
||||
## v1.3.6
|
||||
|
||||
Version bump for toolchain
|
||||
|
||||
## v1.3.4
|
||||
|
||||
Adding platform_family check to include_recipe in source.rb
|
||||
|
||||
## v1.3.2
|
||||
|
||||
Fixing style cops. Updating test harness
|
||||
|
||||
## 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
|
||||
|
||||
### 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
|
||||
|
||||
### 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
|
||||
|
||||
### 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
|
||||
|
||||
### 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
|
||||
|
||||
- [COOK-1998] - Enable override of PHP packages in attributes
|
||||
|
||||
## v1.1.6
|
||||
|
||||
- [COOK-2324] - adds Oracle linux support
|
||||
|
||||
## v1.1.4
|
||||
|
||||
- [COOK-2106] - `php_pear` cannot find available packages
|
||||
|
||||
## v1.1.2
|
||||
|
||||
- [COOK-1803] - use better regexp to match package name
|
||||
- [COOK-1926] - support Amazon linux
|
||||
|
||||
## 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
|
||||
|
||||
- [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)
|
||||
@@ -1,2 +0,0 @@
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
|
||||
@@ -1,15 +0,0 @@
|
||||
<!-- 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)
|
||||
@@ -1,285 +0,0 @@
|
||||
# php Cookbook
|
||||
|
||||
[](http://travis-ci.org/chef-cookbooks/php) [](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.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Platforms
|
||||
|
||||
- Debian, Ubuntu
|
||||
- CentOS, Red Hat, Oracle, Scientific, Amazon Linux
|
||||
- Fedora
|
||||
|
||||
### Chef
|
||||
|
||||
- Chef 12.7+
|
||||
|
||||
### Cookbooks
|
||||
|
||||
- build-essential
|
||||
- xml
|
||||
- mysql
|
||||
|
||||
## 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.
|
||||
|
||||
#### 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
|
||||
- :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
|
||||
|
||||
#### Examples
|
||||
|
||||
```ruby
|
||||
# discover the horde channel
|
||||
php_pear_channel "pear.horde.org" do
|
||||
action :discover
|
||||
end
|
||||
|
||||
# download xml then add the symfony channel
|
||||
remote_file "#{Chef::Config[:file_cache_path]}/symfony-channel.xml" do
|
||||
source "http://pear.symfony-project.com/channel.xml"
|
||||
mode 0644
|
||||
end
|
||||
php_pear_channel "symfony" do
|
||||
channel_xml "#{Chef::Config[:file_cache_path]}/symfony-channel.xml"
|
||||
action :add
|
||||
end
|
||||
|
||||
# update the main pear channel
|
||||
php_pear_channel 'pear.php.net' do
|
||||
action :update
|
||||
end
|
||||
|
||||
# update the main pecl channel
|
||||
php_pear_channel 'pecl.php.net' do
|
||||
action :update
|
||||
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.
|
||||
|
||||
#### 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`
|
||||
|
||||
#### Attribute Parameters
|
||||
|
||||
- `package_name`: name attribute. The name of the pear package to install
|
||||
- version: the version of the pear package to install/upgrade. If no version is given latest is assumed.
|
||||
- `preferred_state`: PEAR by default installs stable packages only, this allows you to install pear packages in a devel, alpha or beta state
|
||||
- `directives`: extra extension directives (settings) for a pecl. on most platforms these usually get rendered into the extension's .ini file
|
||||
- `zend_extensions`: extension filenames which should be loaded with zend_extension.
|
||||
- o`ptions`: Add additional options to the underlying pear package command
|
||||
|
||||
#### Examples
|
||||
|
||||
```ruby
|
||||
# upgrade a pear
|
||||
php_pear "XML_RPC" do
|
||||
action :upgrade
|
||||
end
|
||||
|
||||
|
||||
# install a specific version
|
||||
php_pear "XML_RPC" do
|
||||
version "1.5.4"
|
||||
action :install
|
||||
end
|
||||
|
||||
|
||||
# install the mongodb pecl
|
||||
php_pear "mongo" do
|
||||
action :install
|
||||
end
|
||||
|
||||
# install the xdebug pecl
|
||||
php_pear "xdebug" do
|
||||
# Specify that xdebug.so must be loaded as a zend extension
|
||||
zend_extensions ['xdebug.so']
|
||||
action :install
|
||||
end
|
||||
|
||||
|
||||
# install apc pecl with directives
|
||||
php_pear "apc" do
|
||||
action :install
|
||||
directives(:shm_size => 128, :enable_cli => 1)
|
||||
end
|
||||
|
||||
|
||||
# install the beta version of Horde_Url
|
||||
# from the horde channel
|
||||
hc = php_pear_channel "pear.horde.org" do
|
||||
action :discover
|
||||
end
|
||||
php_pear "Horde_Url" do
|
||||
preferred_state "beta"
|
||||
channel hc.channel_name
|
||||
action :install
|
||||
end
|
||||
|
||||
|
||||
# install the YAML pear from the symfony project
|
||||
sc = php_pear_channel "pear.symfony-project.com" do
|
||||
action :discover
|
||||
end
|
||||
php_pear "YAML" do
|
||||
channel sc.channel_name
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
### `php_fpm_pool`
|
||||
|
||||
Installs the `php-fpm` package appropriate for your distro (if using packages) and configures a FPM pool for you. Currently only supported in Debian-family operating systems and CentOS 7 (or at least tested with such, YMMV if you are using source).
|
||||
|
||||
Please consider FPM functionally pre-release, and test it thoroughly in your environment before using it in production
|
||||
|
||||
More info: <http://php.net/manual/en/install.fpm.php>
|
||||
|
||||
#### Actions
|
||||
|
||||
- `:install`: Installs the FPM pool (default).
|
||||
- `:uninstall`: Removes the FPM pool.
|
||||
|
||||
#### Attribute Parameters
|
||||
|
||||
- `pool_name`: name attribute. The name of the FPM pool.
|
||||
- `listen`: The listen address. Default: `/var/run/php5-fpm.sock`
|
||||
- `user`: The user to run the FPM under. Default should be the webserver user for your distro.
|
||||
- `group`: The group to run the FPM under. Default should be the webserver group for your distro.
|
||||
- `process_manager`: Process manager to use - see <http://php.net/manual/en/install.fpm.configuration.php>. Default: `dynamic`
|
||||
- `max_children`: Max children to scale to. Default: 5
|
||||
- `start_servers`: Number of servers to start the pool with. Default: 2
|
||||
- `min_spare_servers`: Minimum number of servers to have as spares. Default: 1
|
||||
- `max_spare_servers`: Maximum number of servers to have as spares. Default: 3
|
||||
- `chdir`: The startup working directory of the pool. Default: `/`
|
||||
- `additional_config`: Additional parameters in JSON. Default: {}
|
||||
|
||||
#### Examples
|
||||
|
||||
```ruby
|
||||
# Install a FPM pool named "default"
|
||||
php_fpm_pool "default" do
|
||||
action :install
|
||||
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.
|
||||
|
||||
### 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`
|
||||
- `module_fileinfo`
|
||||
- `module_fpdf`
|
||||
- `module_gd`
|
||||
- `module_imap`
|
||||
- `module_ldap`
|
||||
- `module_memcache`
|
||||
- `module_mysql`
|
||||
- `module_pgsql`
|
||||
- `module_sqlite3`
|
||||
|
||||
The installation of the php modules in these recipes can now be accomplished by installing from a native package or via the new php_pear LWRP. For example, the functionality of the `module_memcache` recipe can be enabled in the following ways:
|
||||
|
||||
```ruby
|
||||
# using apt
|
||||
package "php5-memcache" do
|
||||
action :install
|
||||
end
|
||||
|
||||
# using pear LWRP
|
||||
php_pear "memcache" do
|
||||
action :install
|
||||
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:
|
||||
|
||||
```ruby
|
||||
name "php"
|
||||
description "Install php from source"
|
||||
override_attributes(
|
||||
"php" => {
|
||||
"install_method" => "source"
|
||||
}
|
||||
)
|
||||
run_list(
|
||||
"recipe[php]"
|
||||
)
|
||||
```
|
||||
|
||||
## License & Authors
|
||||
|
||||
**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))
|
||||
|
||||
**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
|
||||
|
||||
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.
|
||||
```
|
||||
@@ -1,191 +0,0 @@
|
||||
#
|
||||
# Cookbook:: php
|
||||
# Attributes:: default
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
lib_dir = 'lib'
|
||||
default['php']['install_method'] = 'package'
|
||||
default['php']['directives'] = {}
|
||||
default['php']['bin'] = 'php'
|
||||
|
||||
default['php']['pear'] = 'pear'
|
||||
default['php']['pecl'] = 'pecl'
|
||||
|
||||
default['php']['version'] = '5.6.30'
|
||||
|
||||
default['php']['url'] = 'http://us1.php.net/get'
|
||||
default['php']['checksum'] = '8bc7d93e4c840df11e3d9855dcad15c1b7134e8acf0cf3b90b932baea2d0bde2'
|
||||
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', 'amazon'
|
||||
lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib'
|
||||
default['php']['conf_dir'] = '/etc'
|
||||
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"
|
||||
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'
|
||||
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'
|
||||
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'
|
||||
default['php']['fpm_package'] = 'php5-fpm'
|
||||
default['php']['fpm_pooldir'] = '/etc/php5/fpm/pool.d'
|
||||
default['php']['fpm_user'] = 'www-data'
|
||||
default['php']['fpm_group'] = 'www-data'
|
||||
default['php']['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'
|
||||
if node['platform_version'].to_i == 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']['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 'freebsd'
|
||||
default['php']['conf_dir'] = '/usr/local/etc'
|
||||
default['php']['ext_conf_dir'] = '/usr/local/etc/php'
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev)
|
||||
default['php']['fpm_user'] = 'www'
|
||||
default['php']['fpm_group'] = 'www'
|
||||
default['php']['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'
|
||||
default['php']['ext_conf_dir'] = '/etc/php5/conf.d'
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev)
|
||||
default['php']['fpm_user'] = 'www-data'
|
||||
default['php']['fpm_group'] = 'www-data'
|
||||
default['php']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear)
|
||||
default['php']['mysql']['package'] = 'php5-mysql'
|
||||
end
|
||||
|
||||
default['php']['configure_options'] = %W(--prefix=#{node['php']['prefix_dir']}
|
||||
--with-libdir=#{lib_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=#{node['php']['fpm_user']}
|
||||
--with-fpm-group=#{node['php']['fpm_group']}
|
||||
--with-zlib
|
||||
--with-openssl
|
||||
--with-kerberos
|
||||
--with-bz2
|
||||
--with-curl
|
||||
--enable-ftp
|
||||
--enable-zip
|
||||
--enable-exif
|
||||
--with-gd
|
||||
--enable-gd-native-ttf
|
||||
--with-gettext
|
||||
--with-gmp
|
||||
--with-mhash
|
||||
--with-iconv
|
||||
--with-imap
|
||||
--with-imap-ssl
|
||||
--enable-sockets
|
||||
--enable-soap
|
||||
--with-xmlrpc
|
||||
--with-libevent-dir
|
||||
--with-mcrypt
|
||||
--enable-mbstring
|
||||
--with-t1lib
|
||||
--with-mysql
|
||||
--with-mysqli=/usr/bin/mysql_config
|
||||
--with-mysql-sock
|
||||
--with-sqlite3
|
||||
--with-pdo-mysql
|
||||
--with-pdo-sqlite)
|
||||
@@ -1,48 +0,0 @@
|
||||
if defined?(ChefSpec)
|
||||
ChefSpec.define_matcher :php_pear
|
||||
def install_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :install, resource_name)
|
||||
end
|
||||
|
||||
def remove_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :remove, resource_name)
|
||||
end
|
||||
|
||||
def upgrade_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :upgrade, resource_name)
|
||||
end
|
||||
|
||||
def purge_php_pear(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear, :purge, resource_name)
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
def remove_php_pear_channel(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :remove, resource_name)
|
||||
end
|
||||
|
||||
def update_php_pear_channel(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :update, resource_name)
|
||||
end
|
||||
|
||||
def add_php_pear_channel(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:php_pear_channel, :add, resource_name)
|
||||
end
|
||||
|
||||
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
@@ -1,304 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@chef.io>
|
||||
# Cookbook:: php
|
||||
# Provider:: pear_package
|
||||
#
|
||||
# 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.
|
||||
# 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
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
require 'chef/mixin/language'
|
||||
include Chef::Mixin::ShellOut
|
||||
|
||||
# the logic in all action methods mirror that of
|
||||
# the Chef::Provider::Package which will make
|
||||
# refactoring into core chef easy
|
||||
|
||||
use_inline_resources
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :install do
|
||||
# If we specified a version, and it's not the current version, move to the specified version
|
||||
install_version = @new_resource.version unless @new_resource.version.nil? || @new_resource.version == @current_resource.version
|
||||
|
||||
# If it's not installed at all or an upgrade, install it
|
||||
if install_version || @current_resource.version.nil?
|
||||
description = "install package #{@new_resource} #{install_version}"
|
||||
converge_by(description) do
|
||||
info_output = "Installing #{@new_resource}"
|
||||
info_output << " version #{install_version}" if install_version && !install_version.empty?
|
||||
Chef::Log.info(info_output)
|
||||
install_package(@new_resource.package_name, install_version)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :upgrade do
|
||||
if @current_resource.version != candidate_version
|
||||
orig_version = @current_resource.version || 'uninstalled'
|
||||
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}")
|
||||
upgrade_package(@new_resource.package_name, candidate_version)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if removing_package?
|
||||
description = "remove package #{@new_resource}"
|
||||
converge_by(description) do
|
||||
Chef::Log.info("Removing #{@new_resource}")
|
||||
remove_package(@current_resource.package_name, @new_resource.version)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :purge do
|
||||
if removing_package?
|
||||
description = "purge package #{@new_resource}"
|
||||
converge_by(description) do
|
||||
Chef::Log.info("Purging #{@new_resource}")
|
||||
purge_package(@current_resource.package_name, @new_resource.version)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def removing_package?
|
||||
if @current_resource.version.nil?
|
||||
false # nothing to remove
|
||||
elsif @new_resource.version.nil?
|
||||
true # remove any version of a package
|
||||
elsif @new_resource.version == @current_resource.version
|
||||
true # remove the version we have
|
||||
else
|
||||
false # we don't have the version we want to remove
|
||||
end
|
||||
end
|
||||
|
||||
def expand_options(options)
|
||||
options ? " #{options}" : ''
|
||||
end
|
||||
|
||||
# these methods are the required overrides of
|
||||
# a provider that extends from Chef::Provider::Package
|
||||
# so refactoring into core Chef should be easy
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = new_resource.class.new(new_resource.name)
|
||||
@current_resource.package_name(@new_resource.package_name)
|
||||
@bin = node['php']['pear']
|
||||
if pecl?
|
||||
Chef::Log.debug("#{@new_resource} smells like a pecl...installing package in Pecl mode.")
|
||||
@bin = node['php']['pecl']
|
||||
end
|
||||
Chef::Log.debug("#{@current_resource}: Installed version: #{current_installed_version} Candidate version: #{candidate_version}")
|
||||
|
||||
unless current_installed_version.nil?
|
||||
@current_resource.version(current_installed_version)
|
||||
Chef::Log.debug("Current version is #{@current_resource.version}") if @current_resource.version
|
||||
end
|
||||
@current_resource
|
||||
end
|
||||
|
||||
def current_installed_version
|
||||
@current_installed_version ||= begin
|
||||
version_check_cmd = "#{@bin} -d "
|
||||
version_check_cmd << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
version_check_cmd << " list#{expand_channel(can_haz(@new_resource, 'channel'))}"
|
||||
p = shell_out(version_check_cmd)
|
||||
response = nil
|
||||
response = grep_for_version(p.stdout, @new_resource.package_name) if p.stdout =~ /\.?Installed packages/i
|
||||
response
|
||||
end
|
||||
end
|
||||
|
||||
def candidate_version
|
||||
@candidate_version ||= begin
|
||||
candidate_version_cmd = "#{@bin} -d "
|
||||
candidate_version_cmd << "preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
candidate_version_cmd << " search#{expand_channel(can_haz(@new_resource, 'channel'))}"
|
||||
candidate_version_cmd << " #{@new_resource.package_name}"
|
||||
p = shell_out(candidate_version_cmd)
|
||||
response = nil
|
||||
response = grep_for_version(p.stdout, @new_resource.package_name) if p.stdout =~ /\.?Matched packages/i
|
||||
response
|
||||
end
|
||||
end
|
||||
|
||||
def install_package(name, version)
|
||||
command = "printf \"\r\" | #{@bin} -d"
|
||||
command << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
command << " install -a#{expand_options(@new_resource.options)}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}"
|
||||
command << "-#{version}" if version && !version.empty?
|
||||
pear_shell_out(command)
|
||||
manage_pecl_ini(name, :create, can_haz(@new_resource, 'directives'), can_haz(@new_resource, 'zend_extensions')) if pecl?
|
||||
enable_package(name)
|
||||
end
|
||||
|
||||
def upgrade_package(name, version)
|
||||
command = "printf \"\r\" | #{@bin} -d"
|
||||
command << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
command << " upgrade -a#{expand_options(@new_resource.options)}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}"
|
||||
command << "-#{version}" if version && !version.empty?
|
||||
pear_shell_out(command)
|
||||
manage_pecl_ini(name, :create, can_haz(@new_resource, 'directives'), can_haz(@new_resource, 'zend_extensions')) if pecl?
|
||||
enable_package(name)
|
||||
end
|
||||
|
||||
def remove_package(name, version)
|
||||
command = "#{@bin} uninstall"
|
||||
command << " #{expand_options(@new_resource.options)}"
|
||||
command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}"
|
||||
command << "-#{version}" if version && !version.empty?
|
||||
pear_shell_out(command)
|
||||
disable_package(name)
|
||||
manage_pecl_ini(name, :delete, nil, nil) if pecl?
|
||||
end
|
||||
|
||||
def enable_package(name)
|
||||
execute "#{node['php']['enable_mod']} #{name}" do
|
||||
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') && ::File.exist?(node['php']['disable_mod']) }
|
||||
end
|
||||
end
|
||||
|
||||
def pear_shell_out(command)
|
||||
p = shell_out!(command)
|
||||
# pear/pecl commands return a 0 on failures...we'll grep for it
|
||||
p.invalid! if p.stdout.split('\n').last =~ /^ERROR:.+/i
|
||||
p
|
||||
end
|
||||
|
||||
def purge_package(name, version)
|
||||
remove_package(name, version)
|
||||
end
|
||||
|
||||
def expand_channel(channel)
|
||||
channel ? " -c #{channel}" : ''
|
||||
end
|
||||
|
||||
def prefix_channel(channel)
|
||||
channel ? "#{channel}/" : ''
|
||||
end
|
||||
|
||||
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")
|
||||
p = shell_out("#{node['php']['pecl']} config-get ext_dir")
|
||||
p.stdout.strip
|
||||
end
|
||||
end
|
||||
|
||||
def get_extension_files(name)
|
||||
files = []
|
||||
|
||||
p = shell_out("#{@bin} list-files #{name}")
|
||||
p.stdout.each_line.grep(/^src\s+.*\.so$/i).each do |line|
|
||||
files << line.split[1]
|
||||
end
|
||||
|
||||
files
|
||||
end
|
||||
|
||||
def manage_pecl_ini(name, action, directives, zend_extensions)
|
||||
ext_prefix = extension_dir
|
||||
ext_prefix << ::File::SEPARATOR if ext_prefix[-1].chr != ::File::SEPARATOR
|
||||
|
||||
files = get_extension_files(name)
|
||||
|
||||
extensions = Hash[
|
||||
files.map do |filepath|
|
||||
rel_file = filepath.clone
|
||||
rel_file.slice! ext_prefix if rel_file.start_with? ext_prefix
|
||||
zend = zend_extensions.include?(rel_file)
|
||||
[(zend ? filepath : rel_file), zend]
|
||||
end
|
||||
]
|
||||
|
||||
directory node['php']['ext_conf_dir'] do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
recursive true
|
||||
end
|
||||
|
||||
template "#{node['php']['ext_conf_dir']}/#{name}.ini" do
|
||||
source 'extension.ini.erb'
|
||||
cookbook 'php'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
variables(name: name, extensions: extensions, directives: directives)
|
||||
action action
|
||||
end
|
||||
end
|
||||
|
||||
def grep_for_version(stdout, package)
|
||||
v = nil
|
||||
|
||||
stdout.split(/\n/).grep(/^#{package}\s/i).each do |m|
|
||||
# XML_RPC 1.5.4 stable
|
||||
# mongo 1.1.4/(1.1.4 stable) 1.1.4 MongoDB database driver
|
||||
# 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
|
||||
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
|
||||
|
||||
def pecl?
|
||||
@pecl ||=
|
||||
begin
|
||||
# search as a pear first since most 3rd party channels will report pears as pecls!
|
||||
search_args = ''
|
||||
search_args << " -d preferred_state=#{can_haz(@new_resource, 'preferred_state')}"
|
||||
search_args << " search#{expand_channel(can_haz(@new_resource, 'channel'))} #{@new_resource.package_name}"
|
||||
|
||||
if grep_for_version(shell_out(node['php']['pear'] + search_args).stdout, @new_resource.package_name)
|
||||
false
|
||||
elsif grep_for_version(shell_out(node['php']['pecl'] + search_args).stdout, @new_resource.package_name)
|
||||
true
|
||||
else
|
||||
raise "Package #{@new_resource.package_name} not found in either PEAR or PECL."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: remove when provider is moved into Chef core
|
||||
# this allows PhpPear to work with Chef::Resource::Package
|
||||
def can_haz(resource, attribute_name)
|
||||
resource.respond_to?(attribute_name) ? resource.send(attribute_name) : nil
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: default
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
include_recipe "php::#{node['php']['install_method']}"
|
||||
|
||||
# update the main channels
|
||||
php_pear_channel 'pear.php.net' do
|
||||
action :update
|
||||
end
|
||||
|
||||
php_pear_channel 'pecl.php.net' do
|
||||
action :update
|
||||
end
|
||||
|
||||
include_recipe 'php::ini'
|
||||
@@ -1,29 +0,0 @@
|
||||
#
|
||||
# Author:: Christo De Lange (<opscode@dldinternet.com>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: ini
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
template "#{node['php']['conf_dir']}/php.ini" do
|
||||
source node['php']['ini']['template']
|
||||
cookbook node['php']['ini']['cookbook']
|
||||
owner 'root'
|
||||
group node['root_group']
|
||||
mode '0644'
|
||||
manage_symlink_source true
|
||||
variables(directives: node['php']['directives'])
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_apc
|
||||
#
|
||||
# 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.
|
||||
# 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', 'amazon'
|
||||
package %w(httpd-devel pcre pcre-devel)
|
||||
|
||||
php_pear 'APC' do
|
||||
action :install
|
||||
directives(shm_size: '128M', enable_cli: 0)
|
||||
end
|
||||
when 'debian'
|
||||
package node['php']['apc']['package']
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_apc
|
||||
#
|
||||
# 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.
|
||||
# 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', 'amazon'
|
||||
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
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_curl
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
package node['php']['curl']['package'] do
|
||||
action :install
|
||||
only_if { platform_family?('debian') } # centos php compiled with curl
|
||||
end
|
||||
@@ -1,35 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_fpdf
|
||||
#
|
||||
# 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.
|
||||
# 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', 'amazon'
|
||||
pearhub_chan = php_pear_channel 'pearhub.org' do
|
||||
action :discover
|
||||
end
|
||||
php_pear 'FPDF' do
|
||||
channel pearhub_chan.channel_name
|
||||
action :install
|
||||
end
|
||||
when 'debian'
|
||||
package 'php-fpdf' do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
@@ -1,34 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_gd
|
||||
#
|
||||
# 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.
|
||||
# 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) => {
|
||||
'default' => 'php-gd',
|
||||
},
|
||||
'freebsd' => {
|
||||
'default' => 'php56-gd',
|
||||
},
|
||||
'default' => node['php']['gd']['package']
|
||||
)
|
||||
|
||||
package pkg do
|
||||
action :install
|
||||
end
|
||||
@@ -1,28 +0,0 @@
|
||||
#
|
||||
# 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) => {
|
||||
'default' => 'php-imap',
|
||||
},
|
||||
'default' => 'php5-imap'
|
||||
)
|
||||
|
||||
package pkg do
|
||||
action :install
|
||||
end
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_ldap
|
||||
#
|
||||
# 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.
|
||||
# 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) => {
|
||||
'default' => 'php-ldap',
|
||||
},
|
||||
'default' => node['php']['ldap']['package']
|
||||
)
|
||||
|
||||
package pkg do
|
||||
action :install
|
||||
end
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_memcache
|
||||
#
|
||||
# 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.
|
||||
# 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', 'amazon'
|
||||
package 'zlib-devel'
|
||||
|
||||
php_pear 'memcache' do
|
||||
action :install
|
||||
end
|
||||
when 'debian'
|
||||
package 'php5-memcache'
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_mysql
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
package node['php']['mysql']['package'] do
|
||||
action :install
|
||||
end
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_pgsql
|
||||
#
|
||||
# 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.
|
||||
# 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) => {
|
||||
'default' => 'php-pgsql',
|
||||
},
|
||||
'default' => node['php']['pgsql']['package']
|
||||
)
|
||||
|
||||
package pkg do
|
||||
action :install
|
||||
end
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<joshua@chef.io>)
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: module_sqlite3
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
package node['php']['sqlite']['package'] do
|
||||
action :install
|
||||
only_if { platform_family?('debian') } # already there in centos, --with-pdo-sqlite=shared
|
||||
end
|
||||
@@ -1,34 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Author:: Lucas Hansen (<lucash@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: package
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
if platform_family?('rhel', 'debian', 'amazon', 'suse')
|
||||
package node['php']['packages'] do
|
||||
options node['php']['package_options']
|
||||
end
|
||||
else
|
||||
node['php']['packages'].each do |pkg|
|
||||
package pkg do
|
||||
options node['php']['package_options']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
include_recipe 'php::ini'
|
||||
@@ -1,51 +0,0 @@
|
||||
#
|
||||
# Author:: David Kinzer (<dtkinzer@gmail.com>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: recompile
|
||||
#
|
||||
# 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
version = node['php']['version']
|
||||
configure_options = node['php']['configure_options'].join(' ')
|
||||
ext_dir_prefix = node['php']['ext_dir'] ? "EXTENSION_DIR=#{node['php']['ext_dir']}" : ''
|
||||
|
||||
node['php']['src_deps'].each do |pkg|
|
||||
package pkg do
|
||||
action 'install'
|
||||
end
|
||||
end
|
||||
|
||||
remote_file "#{Chef::Config[:file_cache_path]}/php-#{version}.tar.gz" do
|
||||
source "#{node['php']['url']}/php-#{version}.tar.gz/from/this/mirror"
|
||||
checksum node['php']['checksum']
|
||||
mode '0644'
|
||||
action 'create_if_missing'
|
||||
end
|
||||
|
||||
bash 'un-pack php' do
|
||||
cwd Chef::Config[:file_cache_path]
|
||||
code "tar -zxf php-#{version}.tar.gz"
|
||||
creates "#{Chef::Config[:file_cache_path]}/php-#{version}"
|
||||
end
|
||||
|
||||
bash 're-build php' do
|
||||
cwd "#{Chef::Config[:file_cache_path]}/php-#{version}"
|
||||
code <<-EOF
|
||||
(make clean)
|
||||
(#{ext_dir_prefix} ./configure #{configure_options})
|
||||
(make -j #{node['cpu']['total']} && make install)
|
||||
EOF
|
||||
end
|
||||
@@ -1,86 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: php
|
||||
# Recipe:: source
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
configure_options = node['php']['configure_options'].join(' ')
|
||||
|
||||
include_recipe 'build-essential'
|
||||
include_recipe 'xml'
|
||||
include_recipe 'yum-epel' if node['platform_family'] == 'rhel'
|
||||
|
||||
mysql_client 'default' do
|
||||
action :create
|
||||
only_if { configure_options =~ /mysql/ }
|
||||
end
|
||||
|
||||
package node['php']['src_deps']
|
||||
|
||||
version = node['php']['version']
|
||||
|
||||
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']}) --version | grep #{version}"
|
||||
end
|
||||
|
||||
if node['php']['ext_dir']
|
||||
directory node['php']['ext_dir'] do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
recursive true
|
||||
end
|
||||
ext_dir_prefix = "EXTENSION_DIR=#{node['php']['ext_dir']}"
|
||||
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 -j #{node['cpu']['total']} && make install)
|
||||
EOF
|
||||
not_if "$(which #{node['php']['bin']}) --version | grep #{version}"
|
||||
end
|
||||
|
||||
directory node['php']['conf_dir'] do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
recursive true
|
||||
end
|
||||
|
||||
directory node['php']['ext_conf_dir'] do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
recursive true
|
||||
end
|
||||
|
||||
include_recipe 'php::ini'
|
||||
@@ -1,97 +0,0 @@
|
||||
#
|
||||
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
|
||||
# Cookbook:: php
|
||||
# Resource:: fpm_pool
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
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: {}
|
||||
|
||||
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
|
||||
@@ -1,38 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@chef.io>
|
||||
# Cookbook:: php
|
||||
# Resource:: pear_package
|
||||
#
|
||||
# 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.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
default_action :install
|
||||
actions :install, :upgrade, :remove, :purge
|
||||
|
||||
state_attrs :channel,
|
||||
:directives,
|
||||
:options,
|
||||
:package_name,
|
||||
:preferred_state,
|
||||
:version,
|
||||
:zend_extensions
|
||||
|
||||
attribute :package_name, kind_of: String, name_attribute: true
|
||||
attribute :version, default: nil
|
||||
attribute :channel, kind_of: String
|
||||
attribute :options, kind_of: String
|
||||
attribute :directives, kind_of: Hash, default: {}
|
||||
attribute :zend_extensions, kind_of: Array, default: []
|
||||
attribute :preferred_state, default: 'stable'
|
||||
@@ -1,83 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@chef.io>
|
||||
# Author:: Jennifer Davis <sigje@chef.io>
|
||||
# Cookbook:: php
|
||||
# Resource:: pear_channel
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
property :channel_xml, kind_of: String
|
||||
property :channel_name, kind_of: String, name_property: true
|
||||
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 :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
|
||||
|
||||
action_class do
|
||||
def exists?
|
||||
shell_out!("#{new_resource.pear} channel-info #{new_resource.channel_name}")
|
||||
true
|
||||
rescue Mixlib::ShellOut::ShellCommandFailed
|
||||
false
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
; configuration for php <%= @name %> module
|
||||
<% @extensions.each do |filepath, zend| -%>
|
||||
<%= 'zend_' if zend %>extension=<%= filepath %>
|
||||
<% end -%>
|
||||
<% @directives.each do |k,v| -%>
|
||||
<%= "#{@name}.#{k}=#{v}" %>
|
||||
<% end -%>
|
||||
@@ -1,15 +0,0 @@
|
||||
[<%= @fpm_pool_name %>]
|
||||
user = <%= @fpm_pool_user %>
|
||||
group = <%= @fpm_pool_group %>
|
||||
listen = <%= @fpm_pool_listen %>
|
||||
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 %>
|
||||
pm.min_spare_servers = <%= @fpm_pool_min_spare_servers %>
|
||||
pm.max_spare_servers = <%= @fpm_pool_max_spare_servers %>
|
||||
chdir = <%= @fpm_pool_chdir %>
|
||||
<% @fpm_pool_additional_config.each do |key, value| %>
|
||||
<%= key %> = <%= value %>
|
||||
<% end %>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user