forked from sous-chefs/apache2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmod_php5.rb
84 lines (79 loc) · 2.29 KB
/
mod_php5.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# Cookbook Name:: apache2
# Recipe:: mod_php5
#
# Copyright 2008-2013, Chef Software, Inc.
# Copyright 2014, OneHealth Solutions, Inc.
# Copyright 2014, Viverae, 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 node['apache']['mpm'] != 'prefork'
Chef::Log.warn('apache2::mod_php5 generally is expected to be run under a non-threaded MPM, such as prefork')
Chef::Log.warn('See http://php.net/manual/en/faq.installation.php#faq.installation.apache2')
Chef::Log.warn("Currently the apache2 cookbook is configured to use the '#{node['apache']['mpm']}' MPM")
end
case node['platform_family']
when 'debian'
package 'libapache2-mod-php5'
template "/etc/php5/apache2/php.ini" do
source "mods/php.ini.erb"
owner "root"
group "root"
mode "0644"
end
when 'arch'
package 'php-apache' do
notifies :run, 'execute[generate-module-list]', :immediately
end
when 'rhel'
package 'which'
package 'php package' do
if node['platform_version'].to_f < 6.0
package_name 'php53'
else
package_name 'php'
end
notifies :run, 'execute[generate-module-list]', :immediately
not_if 'which php'
end
when 'fedora'
package 'which'
package 'php' do
notifies :run, 'execute[generate-module-list]', :immediately
not_if 'which php'
end
when 'suse'
package 'which'
package 'php' do
notifies :run, 'execute[generate-module-list]', :immediately
not_if 'which php'
end
when 'freebsd'
%w(php56 libxml2).each do |pkg|
package pkg
end
%w(mod_php56).each do |pkg|
package pkg do
options '-I'
end
end
end unless node['apache']['mod_php5']['install_method'] == 'source'
file "#{node['apache']['dir']}/conf.d/php.conf" do
action :delete
backup false
end
apache_module 'php5' do
conf true
filename node['apache']['mod_php5']['so_filename']
end