Add missing changes for mediawiki upgrades
This commit is contained in:
@@ -1,6 +1,38 @@
|
||||
# php Cookbook CHANGELOG
|
||||
# PHP Cookbook CHANGELOG
|
||||
|
||||
This file is used to list changes made in each version of the php cookbook.
|
||||
This file is used to list changes made in each version of the PHP cookbook.
|
||||
|
||||
## 8.0.0 (2020-07-09)
|
||||
|
||||
- Drop support for:
|
||||
- Debian 8
|
||||
- Ubuntu < 16.04
|
||||
- Amazon Linux 1
|
||||
- Set default PHP version to 7.2.x
|
||||
- Update Ubuntu 18.04 support to source build PHP 7.2
|
||||
- Update attributes for Debian 10
|
||||
- Add support for Ubuntu 20.04
|
||||
- Only symlink GMP on Ubuntu 16.04 to aid source builds
|
||||
- Drop support for installing from source on Debian 9
|
||||
|
||||
## 7.2.0 (2020-06-19)
|
||||
|
||||
- Include extension priority on the specified format to the extension file
|
||||
|
||||
## 7.1.0 (2020-05-05)
|
||||
|
||||
- Split out resource documentation into the documentation folder
|
||||
- Run cookstyle 0.75.1
|
||||
- Fix dependency problem with installing php from source on ubuntu 18.04
|
||||
- Simplify platform checks
|
||||
- Remove unused long_description metadata from metadata.rb
|
||||
- Migrated to Github Actions for testing
|
||||
- Adding control of php-fpm php.ini with specific attribute
|
||||
|
||||
## 7.0.0 (2019-08-07)
|
||||
|
||||
- *Drop support for Chef 13* so we don't need to require build essentials
|
||||
- Sync php.ini template with php.ini-production from php-7.2.18
|
||||
|
||||
## 6.1.1 (2018-08-07)
|
||||
|
||||
@@ -42,7 +74,7 @@ This release removes the previous recipes in this cookbook for setting up variou
|
||||
|
||||
- Converted the php_pear resource to a custom resource
|
||||
- Moved all helper logic out of the resource and into its own helper library file
|
||||
- Fix source install on Ubuntu by making sure we have xml2-config package
|
||||
- Fix source install on Ubuntu by making sure we have xml2-config package
|
||||
- Remove options that are no longer recognised by the php installer when installing from source
|
||||
- Remove matchers as we no longer require them with a modern ChefDK
|
||||
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# Contributing
|
||||
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
|
||||
[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
# php Cookbook
|
||||
|
||||
[](http://travis-ci.org/chef-cookbooks/php) [](https://supermarket.chef.io/cookbooks/php)
|
||||
[](https://supermarket.chef.io/cookbooks/php)
|
||||
[](https://circleci.com/gh/sous-chefs/php)
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
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.
|
||||
|
||||
## Maintainers
|
||||
|
||||
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).
|
||||
|
||||
## Requirements
|
||||
|
||||
### Platforms
|
||||
@@ -14,18 +22,14 @@ It installs and configures PHP and the PEAR package management system. Also incl
|
||||
|
||||
### Chef
|
||||
|
||||
- Chef 12.7+
|
||||
|
||||
### Cookbooks
|
||||
|
||||
- build-essential
|
||||
- Chef 14+
|
||||
|
||||
## 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_setup']` = Boolean value to determine whether to set up pear repositories. Default: `true`
|
||||
- `node['php']['pear_channels']` = List of external pear channels to add if `node['php']['pear_setup]` is true. Default: `['pear.php.net', 'pecl.php.net']`
|
||||
- `node['php']['pear_channels']` = List of external pear channels to add if `node['php']['pear_setup']` is true. Default: `['pear.php.net', 'pecl.php.net']`
|
||||
|
||||
The file also contains the following attribute types:
|
||||
|
||||
@@ -36,175 +40,9 @@ The file also contains the following attribute types:
|
||||
|
||||
This cookbook includes resources 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
|
||||
|
||||
#### Properties
|
||||
|
||||
- `channel_name`: name attribute. The name of the channel to discover
|
||||
- `channel_xml`: the channel.xml file of the channel you are adding
|
||||
- `binary`: 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 resource is clever enough to abstract away the small differences and can be used for managing either. This resource 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
|
||||
- `:reinstall`: Force install of the package even if the same version is already installed. Note: This will converge on every Chef run and is probably not what you want.
|
||||
- `:purge`: An alias for remove as the two behave the same in pear
|
||||
|
||||
#### Properties
|
||||
|
||||
- `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.
|
||||
- `channel`:
|
||||
- `options`: Add additional options to the underlying pear package command
|
||||
- `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.
|
||||
- `preferred_state`: PEAR by default installs stable packages only, this allows you to install pear packages in a devel, alpha or beta state
|
||||
- `binary`: The pear binary to use, by default pear, can be overridden if the binary is not called pear, e.g. pear7
|
||||
|
||||
#### 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 'Install mongo but use a different resource name' do
|
||||
package_name 'mongo'
|
||||
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 using the pear-7 binary
|
||||
php_pear 'apc' do
|
||||
action :install
|
||||
binary 'pear7'
|
||||
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
|
||||
```
|
||||
- [php_pear](https://github.com/sous-chefs/php/tree/master/documentation/php_pear.md)
|
||||
- [php_pear_channel](https://github.com/sous-chefs/php/tree/master/documentation/php_pear_channel.md)
|
||||
- [php_fpm_pool](https://github.com/sous-chefs/php/tree/master/documentation/php_fpm_pool.md)
|
||||
|
||||
## Recipes
|
||||
|
||||
@@ -220,11 +58,13 @@ This recipe installs PHP from packages.
|
||||
|
||||
This recipe installs PHP from source.
|
||||
|
||||
*Note:* Debian 9 is not supported for building from source.
|
||||
|
||||
## 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:
|
||||
### Role example
|
||||
|
||||
```ruby
|
||||
name 'php'
|
||||
@@ -239,25 +79,27 @@ run_list(
|
||||
)
|
||||
```
|
||||
|
||||
## Maintainers
|
||||
## Contributors
|
||||
|
||||
This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/)
|
||||
This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false)
|
||||
|
||||
## License
|
||||
### Backers
|
||||
|
||||
**Copyright:** 2011-2018, Chef Software, Inc.
|
||||
**Copyright:** 2018, Oracle and/or its affiliates. All rights reserved
|
||||
Thank you to all our backers!
|
||||
|
||||
```
|
||||
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
|
||||
### Sponsors
|
||||
|
||||
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.
|
||||
```
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
@@ -18,13 +18,14 @@
|
||||
#
|
||||
|
||||
lib_dir = 'lib'
|
||||
|
||||
default['php']['install_method'] = 'package'
|
||||
default['php']['directives'] = {}
|
||||
default['php']['bin'] = 'php'
|
||||
|
||||
default['php']['pecl'] = 'pecl'
|
||||
|
||||
default['php']['version'] = '5.6.30'
|
||||
default['php']['version'] = '7.2.31'
|
||||
|
||||
default['php']['pear'] = '/usr/bin/pear'
|
||||
default['php']['pear_setup'] = true
|
||||
@@ -33,20 +34,23 @@ default['php']['pear_channels'] = [
|
||||
'pecl.php.net',
|
||||
]
|
||||
|
||||
default['php']['url'] = 'http://us1.php.net/get'
|
||||
default['php']['checksum'] = '8bc7d93e4c840df11e3d9855dcad15c1b7134e8acf0cf3b90b932baea2d0bde2'
|
||||
default['php']['url'] = 'https://www.php.net/distributions'
|
||||
default['php']['checksum'] = '796837831ccebf00dc15921ed327cfbac59177da41b33044d9a6c7134cdd250c' # checksum of the .tar.gz files
|
||||
default['php']['prefix_dir'] = '/usr/local'
|
||||
default['php']['enable_mod'] = '/usr/sbin/php5enmod'
|
||||
default['php']['disable_mod'] = '/usr/sbin/php5dismod'
|
||||
default['php']['enable_mod'] = '/usr/sbin/phpenmod'
|
||||
default['php']['disable_mod'] = '/usr/sbin/phpdismod'
|
||||
|
||||
default['php']['ini']['template'] = 'php.ini.erb'
|
||||
default['php']['ini']['cookbook'] = 'php'
|
||||
|
||||
default['php']['fpm_socket'] = '/var/run/php5-fpm.sock'
|
||||
default['php']['fpm_socket'] = '/var/run/php7.2-fpm.sock'
|
||||
default['php']['fpm_conf_dir'] = nil
|
||||
default['php']['fpm_ini_control'] = false
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora', 'amazon'
|
||||
when 'rhel', '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'
|
||||
@@ -54,21 +58,14 @@ when 'rhel', 'fedora', 'amazon'
|
||||
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 on 201X amazon
|
||||
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 libxml2-devel libxslt-devel zlib-devel)
|
||||
default['php']['fpm_package'] = 'php-fpm'
|
||||
|
||||
if node['platform_version'].to_i == 2
|
||||
default['php']['packages'] = %w(php php-devel php-pear)
|
||||
default['php']['fpm_package'] = 'php-fpm'
|
||||
else
|
||||
default['php']['packages'] = %w(php56 php56-devel php-pear)
|
||||
default['php']['fpm_package'] = 'php56-fpm'
|
||||
end
|
||||
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 libxml2-devel libxslt-devel zlib-devel mhash-devel)
|
||||
default['php']['packages'] = %w(php php-devel php-cli php-pear)
|
||||
default['php']['fpm_package'] = 'php-fpm'
|
||||
end
|
||||
default['php']['src_deps'] = if platform?('amazon') || node['platform_version'].to_i < 8
|
||||
%w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel libxml2-devel libxslt-devel zlib-devel mhash-devel)
|
||||
else # redhat does not name their packages with version on RHEL 6+
|
||||
%w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel libxml2-devel libxslt-devel zlib-devel mhash-devel)
|
||||
end
|
||||
default['php']['packages'] = %w(php php-devel php-cli php-pear)
|
||||
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'
|
||||
@@ -79,86 +76,73 @@ when 'rhel', 'fedora', 'amazon'
|
||||
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 libxml2-dev libxslt-dev zlib1g-dev)
|
||||
default['php']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear)
|
||||
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']['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 libjpeg-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev)
|
||||
default['php']['packages'] = %w(php7.0-cgi php7.0 php7.0-dev php7.0-cli php-pear)
|
||||
default['php']['disable_mod'] = '/usr/sbin/phpdismod'
|
||||
default['php']['enable_mod'] = '/usr/sbin/phpenmod'
|
||||
default['php']['fpm_default_conf'] = '/etc/php/7.0/fpm/pool.d/www.conf'
|
||||
default['php']['fpm_conf_dir'] = '/etc/php/7.0/fpm'
|
||||
default['php']['ext_conf_dir'] = '/etc/php/7.0/mods-available'
|
||||
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_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'
|
||||
|
||||
if (platform?('debian') && node['platform_version'].to_i >= 9) ||
|
||||
(platform?('ubuntu') && node['platform_version'].to_f == 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 libxml2-dev)
|
||||
default['php']['packages'] = %w(php7.0-cgi php7.0 php7.0-dev php7.0-cli php-pear)
|
||||
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'
|
||||
elsif platform?('ubuntu') && node['platform_version'].to_f >= 18.04
|
||||
default['php']['version'] = '7.0.4'
|
||||
default['php']['checksum'] = 'f6cdac2fd37da0ac0bbcee0187d74b3719c2f83973dfe883d5cde81c356fe0a8'
|
||||
if platform?('debian') && node['platform_version'].to_i >= 10
|
||||
default['php']['version'] = '7.3.19'
|
||||
default['php']['checksum'] = '809126b46d62a1a06c2d5a0f9d7ba61aba40e165f24d2d185396d0f9646d3280'
|
||||
default['php']['conf_dir'] = '/etc/php/7.3/cli'
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-turbo-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev file re2c libzip-dev)
|
||||
# Debian >= 10 drops versions from the package names
|
||||
default['php']['packages'] = %w(php-cgi php php-dev php-cli php-pear)
|
||||
default['php']['fpm_package'] = 'php7.3-fpm'
|
||||
default['php']['fpm_pooldir'] = '/etc/php/7.3/fpm/pool.d'
|
||||
default['php']['fpm_service'] = 'php7.3-fpm'
|
||||
default['php']['fpm_socket'] = '/var/run/php/php7.3-fpm.sock'
|
||||
default['php']['fpm_default_conf'] = '/etc/php/7.3/fpm/pool.d/www.conf'
|
||||
default['php']['fpm_conf_dir'] = '/etc/php/7.3/fpm'
|
||||
default['php']['ext_conf_dir'] = '/etc/php/7.3/mods-available'
|
||||
elsif platform?('ubuntu') && node['platform_version'].to_f == 18.04
|
||||
default['php']['version'] = '7.2.31'
|
||||
default['php']['checksum'] = '796837831ccebf00dc15921ed327cfbac59177da41b33044d9a6c7134cdd250c'
|
||||
default['php']['conf_dir'] = '/etc/php/7.2/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 libxml2-dev)
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev)
|
||||
default['php']['packages'] = %w(php7.2-cgi php7.2 php7.2-dev php7.2-cli php-pear)
|
||||
default['php']['fpm_package'] = 'php7.2-fpm'
|
||||
default['php']['fpm_pooldir'] = '/etc/php/7.2/fpm/pool.d'
|
||||
default['php']['fpm_service'] = 'php7.2-fpm'
|
||||
default['php']['fpm_socket'] = '/var/run/php/php7.2-fpm.sock'
|
||||
default['php']['fpm_default_conf'] = '/etc/php/7.2/fpm/pool.d/www.conf'
|
||||
default['php']['fpm_conf_dir'] = '/etc/php/7.2/fpm'
|
||||
default['php']['ext_conf_dir'] = '/etc/php/7.2/mods-available'
|
||||
elsif platform?('ubuntu') && node['platform_version'].to_f >= 20.04
|
||||
default['php']['version'] = '7.4.7'
|
||||
default['php']['checksum'] = 'a554a510190e726ebe7157fb00b4aceabdb50c679430510a3b93cbf5d7546e44'
|
||||
default['php']['conf_dir'] = '/etc/php/7.4/cli'
|
||||
default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev libsqlite3-dev libonig-dev)
|
||||
# Ubuntu >= 20.04 drops versions from the package names
|
||||
default['php']['packages'] = %w(php-cgi php php-dev php-cli php-pear)
|
||||
default['php']['fpm_package'] = 'php7.4-fpm'
|
||||
default['php']['fpm_pooldir'] = '/etc/php/7.4/fpm/pool.d'
|
||||
default['php']['fpm_service'] = 'php7.4-fpm'
|
||||
default['php']['fpm_socket'] = '/var/run/php/php7.4-fpm.sock'
|
||||
default['php']['fpm_default_conf'] = '/etc/php/7.4/fpm/pool.d/www.conf'
|
||||
default['php']['fpm_conf_dir'] = '/etc/php/7.4/fpm'
|
||||
default['php']['enable_mod'] = '/usr/sbin/phpenmod'
|
||||
default['php']['disable_mod'] = '/usr/sbin/phpdismod'
|
||||
default['php']['ext_conf_dir'] = '/etc/php/7.2/mods-available'
|
||||
default['php']['ext_conf_dir'] = '/etc/php/7.4/mods-available'
|
||||
end
|
||||
|
||||
case node['platform']
|
||||
when 'ubuntu'
|
||||
case node['platform_version'].to_f
|
||||
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 libxml2-devel libxslt-devel zlib-devel)
|
||||
default['php']['fpm_default_conf'] = '/etc/php-fpm.d/www.conf'
|
||||
default['php']['fpm_pooldir'] = '/etc/php5/fpm'
|
||||
default['php']['fpm_service'] = 'php-fpm'
|
||||
default['php']['fpm_package'] = 'php5-fpm'
|
||||
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)
|
||||
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 )
|
||||
end
|
||||
|
||||
default['php']['src_recompile'] = false
|
||||
|
||||
default['php']['configure_options'] = %W(--prefix=#{node['php']['prefix_dir']}
|
||||
--with-libdir=#{lib_dir}
|
||||
--with-config-file-path=#{node['php']['conf_dir']}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -18,6 +18,26 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
if node['php']['fpm_ini_control']
|
||||
|
||||
service node['php']['fpm_service'] do
|
||||
action :enable
|
||||
end
|
||||
|
||||
template "#{node['php']['fpm_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'])
|
||||
notifies :restart, "service[#{node['php']['fpm_service']}]"
|
||||
not_if { node['php']['fpm_conf_dir'].nil? }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
template "#{node['php']['conf_dir']}/php.ini" do
|
||||
source node['php']['ini']['template']
|
||||
cookbook node['php']['ini']['cookbook']
|
||||
|
||||
@@ -19,16 +19,8 @@
|
||||
# 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
|
||||
package node['php']['packages'] do
|
||||
options node['php']['package_options']
|
||||
end
|
||||
|
||||
include_recipe 'php::ini'
|
||||
|
||||
@@ -18,34 +18,6 @@
|
||||
# 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.default['php']['src_recompile'] = true
|
||||
|
||||
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
|
||||
include_recipe 'php::source'
|
||||
|
||||
@@ -18,20 +18,41 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
configure_options = node['php']['configure_options'].join(' ')
|
||||
if platform?('debian') && node['platform_version'].to_i == 9
|
||||
Chef::Log.fatal 'Debian 9 is not supported when building from source'
|
||||
end
|
||||
|
||||
build_essential 'install compilation tools'
|
||||
include_recipe 'yum-epel' if node['platform_family'] == 'rhel'
|
||||
version = node['php']['version']
|
||||
configure_options = node['php']['configure_options'].join(' ')
|
||||
ext_dir_prefix = node['php']['ext_dir'] ? "EXTENSION_DIR=#{node['php']['ext_dir']}" : ''
|
||||
|
||||
php_exists = if node['php']['src_recompile']
|
||||
false
|
||||
else
|
||||
"$(which #{node['php']['bin']}) --version | grep #{version}"
|
||||
end
|
||||
|
||||
build_essential
|
||||
|
||||
include_recipe 'yum-epel' if platform_family?('rhel', 'amazon')
|
||||
|
||||
package node['php']['src_deps']
|
||||
|
||||
version = node['php']['version']
|
||||
log "php_exists == #{php_exists}"
|
||||
|
||||
remote_file "#{Chef::Config[:file_cache_path]}/php-#{version}.tar.gz" do
|
||||
source "#{node['php']['url']}/php-#{version}.tar.gz/from/this/mirror"
|
||||
source "#{node['php']['url']}/php-#{version}.tar.gz"
|
||||
checksum node['php']['checksum']
|
||||
mode '0644'
|
||||
not_if "$(which #{node['php']['bin']}) --version | grep #{version}"
|
||||
action :create_if_missing
|
||||
not_if php_exists
|
||||
notifies :run, 'execute[un-pack php]', :immediately
|
||||
end
|
||||
|
||||
execute 'un-pack php' do
|
||||
cwd Chef::Config[:file_cache_path]
|
||||
command "tar -zxf php-#{version}.tar.gz"
|
||||
creates "#{Chef::Config[:file_cache_path]}/php-#{version}"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
if node['php']['ext_dir']
|
||||
@@ -41,26 +62,31 @@ if node['php']['ext_dir']
|
||||
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.
|
||||
# PHP is unable to find the GMP library on Ubuntu 16.04
|
||||
# This symlink brings the file inside of the included 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 }
|
||||
only_if { platform?('ubuntu') && node['platform_version'].to_f == 16.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}"
|
||||
execute 'clean build' do
|
||||
cwd "#{Chef::Config[:file_cache_path]}/php-#{version}"
|
||||
command 'make clean'
|
||||
only_if { node['php']['src_recompile'] }
|
||||
end
|
||||
|
||||
execute 'configure php' do
|
||||
cwd "#{Chef::Config[:file_cache_path]}/php-#{version}"
|
||||
command "#{ext_dir_prefix} ./configure #{configure_options}"
|
||||
not_if php_exists
|
||||
end
|
||||
|
||||
execute 'build and install php' do
|
||||
cwd "#{Chef::Config[:file_cache_path]}/php-#{version}"
|
||||
command "make -j #{node['cpu']['total']} && make install"
|
||||
not_if php_exists
|
||||
end
|
||||
|
||||
directory node['php']['conf_dir'] do
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
#
|
||||
|
||||
property :package_name, String, name_property: true
|
||||
property :version, [String, nil], default: nil
|
||||
property :version, [String, nil]
|
||||
property :channel, String
|
||||
property :options, String
|
||||
property :directives, Hash, default: {}
|
||||
property :zend_extensions, Array, default: []
|
||||
property :preferred_state, String, default: 'stable'
|
||||
property :binary, String, default: 'pear'
|
||||
property :priority, [String, nil], default: nil
|
||||
property :priority, [String, nil]
|
||||
|
||||
def current_installed_version(new_resource)
|
||||
version_check_cmd = "#{new_resource.binary} -d"
|
||||
@@ -69,6 +69,8 @@ load_current_value do |new_resource|
|
||||
end
|
||||
|
||||
action :install do
|
||||
build_essential
|
||||
|
||||
# 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
|
||||
# Check if the version we want is already installed
|
||||
@@ -87,6 +89,8 @@ end
|
||||
|
||||
# reinstall is just an install that always fires
|
||||
action :reinstall do
|
||||
build_essential
|
||||
|
||||
install_version = new_resource.version unless new_resource.version.nil?
|
||||
converge_by("reinstall package #{new_resource.package_name} #{install_version}") do
|
||||
info_output = "Installing #{new_resource.package_name}"
|
||||
@@ -214,7 +218,14 @@ action_class do
|
||||
def get_extension_files(name)
|
||||
files = []
|
||||
|
||||
p = shell_out("#{new_resource.binary} list-files #{name}")
|
||||
# use appropriate binary when listing pecl packages
|
||||
list_binary = if new_resource.channel == 'pecl.php.net'
|
||||
node['php']['pecl']
|
||||
else
|
||||
new_resource.binary
|
||||
end
|
||||
|
||||
p = shell_out("#{list_binary} list-files #{name}")
|
||||
p.stdout.each_line.grep(/^src\s+.*\.so$/i).each do |line|
|
||||
files << line.split[1]
|
||||
end
|
||||
@@ -231,7 +242,11 @@ action_class do
|
||||
search_args << " search#{expand_channel(new_resource.channel)} #{new_resource.package_name}"
|
||||
|
||||
if grep_for_version(shell_out(new_resource.binary + search_args).stdout, new_resource.package_name)
|
||||
false
|
||||
if (new_resource.binary.include? 'pecl') || (new_resource.channel == 'pecl.php.net')
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
elsif grep_for_version(shell_out(node['php']['pecl'] + search_args).stdout, new_resource.package_name)
|
||||
true
|
||||
else
|
||||
@@ -276,5 +291,10 @@ action_class do
|
||||
)
|
||||
action action
|
||||
end
|
||||
|
||||
execute "#{node['php']['enable_mod']} #{name}" do
|
||||
creates "#{node['php']['conf_dir']}/conf.d/#{name}"
|
||||
only_if { platform_family? 'debian' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
property :channel_xml, String
|
||||
property :channel_name, String, name_property: true
|
||||
property :binary, String, default: 'pear'
|
||||
# TODO: add authenticated channel support!
|
||||
# property :username, :kind_of => String
|
||||
# property :password, :kind_of => String
|
||||
|
||||
action :discover do
|
||||
unless exists?
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
; configuration for php <%= @name %> module
|
||||
<% if @priority %>
|
||||
; priority=<%= @priority %>
|
||||
<% end -%>
|
||||
<% @extensions.each do |filepath, zend| -%>
|
||||
<%= 'zend_' if zend %>extension=<%= filepath %>
|
||||
<% end -%>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user