Skip to content

Commit d2084cc

Browse files
committed
Add example of how to configure php for el9 based systems
Signed-off-by: Mike van Goor <mvangoor@schubergphilis.com>
1 parent e05c008 commit d2084cc

File tree

5 files changed

+34
-11
lines changed

5 files changed

+34
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This file is used to list changes made in each version of the apache2 cookbook.
44

55
## Unreleased
66

7+
- Add example of how to configure php fpm pool config for rhel9 and derivatives
8+
79
## 9.3.3 - *2024-07-15*
810

911
Standardise files with files in sous-chefs/repo-management

kitchen.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ suites:
5050
- name: mod_php
5151
run_list:
5252
- recipe[test::php]
53-
excludes:
54-
- almalinux-9
55-
- amazonlinux-2023
56-
- centos-stream-9
57-
- fedora-latest
58-
- oraclelinux-9
59-
- rockylinux-9
6053
- name: mod_wsgi
6154
run_list:
6255
- recipe[test::wsgi]

spec/resources/mod_php_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232

3333
it do
3434
is_expected.to enable_apache2_module('php').with(
35-
identifier: 'php7_module',
36-
mod_name: 'libphp7.4.so'
35+
identifier: 'php_module',
36+
mod_name: 'libphp8.1.so'
3737
)
3838
end
3939
end

test/cookbooks/test/recipes/php.rb

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,33 @@
33
notifies :restart, 'apache2_service[default]'
44
end
55

6-
apache2_mod_php '' do
7-
notifies :reload, 'apache2_service[default]'
6+
if apache_mod_php_supported?
7+
apache2_mod_php '' do
8+
notifies :reload, 'apache2_service[default]'
9+
end
10+
else
11+
apache2_module 'proxy' do
12+
notifies :reload, 'apache2_service[default]'
13+
end
14+
apache2_module 'proxy_fcgi' do
15+
notifies :reload, 'apache2_service[default]'
16+
end
17+
apache2_mod_proxy 'proxy' do
18+
notifies :reload, 'apache2_service[default]'
19+
end
20+
php_fpm_pool 'nagios' do
21+
user default_apache_user
22+
group default_apache_group
23+
listen_user default_apache_user
24+
listen_group default_apache_group
25+
end
26+
apache2_conf 'custom_php_pool' do
27+
template_cookbook 'test'
28+
options(
29+
apache_php_handler: "proxy:unix:#{php_fpm_socket}|fcgi://localhost"
30+
)
31+
notifies :reload, 'apache2_service[default]'
32+
end
833
end
934

1035
file "#{default_docroot_dir}/info.php" do
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
2+
SetHandler "<%= @apache_php_handler %>"
3+
</FilesMatch>

0 commit comments

Comments
 (0)