File tree Expand file tree Collapse file tree 4 files changed +45
-8
lines changed Expand file tree Collapse file tree 4 files changed +45
-8
lines changed Original file line number Diff line number Diff line change 33#
44# @todo
55# Add docs
6- # @note Unsupported platforms: SLES: all
76class apache::mod::php (
87 $package_name = undef ,
98 $package_ensure = ' present' ,
1716 $libphp_prefix = ' libphp'
1817) inherits apache::params {
1918 include apache
20- $mod = " php${php_version} "
19+ if (versioncmp($php_version , ' 8' ) < 0) {
20+ $mod = " php${php_version} "
21+ } else {
22+ $mod = ' php'
23+ }
2124
2225 if $apache::version::scl_httpd_version == undef and $apache::version::scl_php_version != undef {
2326 fail(' If you define apache::version::scl_php_version, you also need to specify apache::version::scl_httpd_version' )
6669 # Controls php version and libphp prefix
6770 $_lib = " ${libphp_prefix}${php_version} .so"
6871 }
72+ $_module_id = $_php_major ? {
73+ ' 5' => ' php5_module' ,
74+ ' 7' => ' php7_module' ,
75+ default => ' php_module' ,
76+ }
6977
7078 if $::operatingsystem == ' SLES' {
7179 ::apache::mod { $mod:
7280 package => $_package_name,
7381 package_ensure => $package_ensure ,
7482 lib => " mod_${mod} .so" ,
75- id => " php${_php_major}_module " ,
83+ id => $_module_id ,
7684 path => " ${apache::lib_path} /mod_${mod} .so" ,
7785 }
7886 } else {
7987 ::apache::mod { $mod:
8088 package => $_package_name,
8189 package_ensure => $package_ensure ,
8290 lib => $_lib,
83- id => " php${_php_major}_module " ,
91+ id => $_module_id ,
8492 path => $path ,
8593 }
8694 }
Original file line number Diff line number Diff line change 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' ,
Original file line number Diff line number Diff 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' }
Original file line number Diff line number Diff line change 5353 )
5454 }
5555 end
56+ when '10'
57+ context 'on buster' do
58+ it { is_expected . to contain_apache__mod ( 'php7.3' ) }
59+ it { is_expected . to contain_package ( 'libapache2-mod-php7.3' ) }
60+ it {
61+ is_expected . to contain_file ( 'php7.3.load' ) . with (
62+ content : "LoadModule php7_module /usr/lib/apache2/modules/libphp7.3.so\n " ,
63+ )
64+ }
65+ end
66+ context 'on buster with experimental php8.0' do
67+ let :params do
68+ { php_version : '8.0' }
69+ end
70+
71+ it { is_expected . to contain_apache__mod ( 'php' ) }
72+ it { is_expected . to contain_package ( 'libapache2-mod-php8.0' ) }
73+ it {
74+ is_expected . to contain_file ( 'php.load' ) . with (
75+ content : "LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so\n " ,
76+ )
77+ }
78+ end
5679 when '16.04'
5780 context 'on stretch' do
5881 let :params do
207230
208231 # all the following tests are for legacy php/apache versions. They don't work on modern ubuntu and redhat 8
209232 next if ( facts [ :os ] [ 'release' ] [ 'major' ] . to_i > 15 && facts [ :os ] [ 'name' ] == 'Ubuntu' ) ||
233+ ( facts [ :os ] [ 'release' ] [ 'major' ] . to_i >= 15 && facts [ :os ] [ 'name' ] == 'SLES' ) ||
210234 ( facts [ :os ] [ 'release' ] [ 'major' ] . to_i >= 9 && facts [ :os ] [ 'name' ] == 'Debian' ) ||
211235 ( facts [ :os ] [ 'release' ] [ 'major' ] . to_i >= 8 && ( facts [ :os ] [ 'name' ] == 'RedHat' || facts [ :os ] [ 'name' ] == 'CentOS' ) )
212236
You can’t perform that action at this time.
0 commit comments