Skip to content

Commit 55a3e5f

Browse files
author
Ciaran McCrisken
committed
(MODULES-10899) Install PHP 7 by default on SLES >= 15
On SLES >= 15 it appears as though the `apache2-mod_php5` package is no longer available in the default repo. This commit ensures that the default value for the $php_version parameter is 7 on SLES >= 15 and the appropriate `apache2-mod_php7` package is used.
1 parent 16a4d4b commit 55a3e5f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

manifests/params.pp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,26 +698,27 @@
698698
$logroot_mode = undef
699699
$lib_path = '/usr/lib64/apache2' #changes for some modules based on mpm
700700
$mpm_module = 'prefork'
701-
702701
if versioncmp($::operatingsystemrelease, '15') < 0 {
703702
$default_ssl_cert = '/etc/apache2/ssl.crt/server.crt'
704703
$default_ssl_key = '/etc/apache2/ssl.key/server.key'
704+
$php_version = '5'
705705
} else {
706706
$default_ssl_cert = '/etc/apache2/ssl.crt/default-server.crt'
707707
$default_ssl_key = '/etc/apache2/ssl.key/default-server.key'
708+
$php_version = '7'
708709
}
710+
$suphp_configpath = "/etc/php${php_version}/apache2"
709711
$ssl_sessioncache = '/var/lib/apache2/ssl_scache(512000)'
710712
$suphp_addhandler = 'x-httpd-php'
711713
$suphp_engine = 'off'
712-
$suphp_configpath = '/etc/php5/apache2'
713-
$php_version = '5'
714714
if versioncmp($::operatingsystemrelease, '11') < 0 or versioncmp($::operatingsystemrelease, '12') >= 0 {
715-
$mod_packages = {
715+
$mod_packages = {
716716
'auth_kerb' => 'apache2-mod_auth_kerb',
717717
'auth_gssapi' => 'apache2-mod_auth_gssapi',
718718
'dav_svn' => 'subversion-server',
719719
'perl' => 'apache2-mod_perl',
720720
'php5' => 'apache2-mod_php5',
721+
'php7' => 'apache2-mod_php7',
721722
'python' => 'apache2-mod_python',
722723
'security' => 'apache2-mod_security2',
723724
'worker' => 'apache2-worker',

spec/acceptance/mod_php_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class { 'apache::mod::php': }
4545
describe file("#{apache_hash['mod_dir']}/php7.conf") do
4646
it { is_expected.to contain 'DirectoryIndex index.php' }
4747
end
48+
elsif os[:family] == 'sles' && os[:release].to_i >= 15
49+
describe file("#{apache_hash['mod_dir']}/php7.conf") do
50+
it { is_expected.to contain 'DirectoryIndex index.php' }
51+
end
4852
else
4953
describe file("#{apache_hash['mod_dir']}/php5.conf") do
5054
it { is_expected.to contain 'DirectoryIndex index.php' }

0 commit comments

Comments
 (0)