diff --git a/CHANGELOG.md b/CHANGELOG.md index a8ec8bff5..e0dfb0e6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the apache2 cookbook. ## Unreleased +- Add example of how to configure php fpm pool config for rhel9 and derivatives + ## 9.3.3 - *2024-07-15* Standardise files with files in sous-chefs/repo-management diff --git a/documentation/resource_apache2_mod.md b/documentation/resource_apache2_mod.md index 4df5a29f6..efcdbda18 100644 --- a/documentation/resource_apache2_mod.md +++ b/documentation/resource_apache2_mod.md @@ -8,11 +8,11 @@ This will use a template resource to write the module's configuration file in th ## Properties -| Name | Type | Default | Description | -| ------------ | ------ | --------------------------- | ---------------------------------------------------------------------- | -| `template` | String | | Name of the template | -| `root_group` | String | `node['root_group']` | Set to override the platforms default root group for the template file | -| `template_cookbook` | String | `apache2` | Cookbook containing the template file +| Name | Type | Default | Description | +| ------------------- | ------ | --------------------------- | ---------------------------------------------------------------------- | +| `template` | String | | Name of the template | +| `root_group` | String | `node['root_group']` | Set to override the platforms default root group for the template file | +| `template_cookbook` | String | `apache2` | Cookbook containing the template file | ## Examples diff --git a/kitchen.yml b/kitchen.yml index f291e9df6..a5987898b 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -50,13 +50,6 @@ suites: - name: mod_php run_list: - recipe[test::php] - excludes: - - almalinux-9 - - amazonlinux-2023 - - centos-stream-9 - - fedora-latest - - oraclelinux-9 - - rockylinux-9 - name: mod_wsgi run_list: - recipe[test::wsgi] diff --git a/spec/resources/mod_php_spec.rb b/spec/resources/mod_php_spec.rb index a9cdb5494..ff2fb3e70 100644 --- a/spec/resources/mod_php_spec.rb +++ b/spec/resources/mod_php_spec.rb @@ -32,8 +32,8 @@ it do is_expected.to enable_apache2_module('php').with( - identifier: 'php7_module', - mod_name: 'libphp7.4.so' + identifier: 'php_module', + mod_name: 'libphp8.1.so' ) end end diff --git a/test/cookbooks/test/recipes/php.rb b/test/cookbooks/test/recipes/php.rb index 58c192c04..4dbed598d 100644 --- a/test/cookbooks/test/recipes/php.rb +++ b/test/cookbooks/test/recipes/php.rb @@ -3,8 +3,33 @@ notifies :restart, 'apache2_service[default]' end -apache2_mod_php '' do - notifies :reload, 'apache2_service[default]' +if apache_mod_php_supported? + apache2_mod_php '' do + notifies :reload, 'apache2_service[default]' + end +else + apache2_module 'proxy' do + notifies :reload, 'apache2_service[default]' + end + apache2_module 'proxy_fcgi' do + notifies :reload, 'apache2_service[default]' + end + apache2_mod_proxy 'proxy' do + notifies :reload, 'apache2_service[default]' + end + php_fpm_pool 'nagios' do + user default_apache_user + group default_apache_group + listen_user default_apache_user + listen_group default_apache_group + end + apache2_conf 'custom_php_pool' do + template_cookbook 'test' + options( + apache_php_handler: "proxy:unix:#{php_fpm_socket}|fcgi://localhost" + ) + notifies :reload, 'apache2_service[default]' + end end file "#{default_docroot_dir}/info.php" do diff --git a/test/cookbooks/test/templates/custom_php_pool.conf.erb b/test/cookbooks/test/templates/custom_php_pool.conf.erb new file mode 100644 index 000000000..b993567ce --- /dev/null +++ b/test/cookbooks/test/templates/custom_php_pool.conf.erb @@ -0,0 +1,3 @@ + + SetHandler "<%= @apache_php_handler %>" +