Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for mod_php on Ubuntu 22.04 #2278

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions manifests/mod/php.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@
String $libphp_prefix = 'libphp'
) inherits apache::params {
include apache
if (versioncmp($php_version, '8') < 0) {
$mod = "php${php_version}"
} else {
# RedHat + PHP 8 drop the major version in apache module name.
if ($facts['os']['family'] == 'RedHat') and (versioncmp($php_version, '8') >= 0) {
$mod = 'php'
} else {
$mod = "php${php_version}"
}

if $apache::version::scl_httpd_version == undef and $apache::version::scl_php_version != undef {
Expand Down Expand Up @@ -87,12 +88,11 @@
$_php_version_no_dot = regsubst($php_version, '\.', '')
if $apache::version::scl_httpd_version {
$_lib = "librh-php${_php_version_no_dot}-php${_php_major}.so"
} elsif ($facts['os']['family'] == 'RedHat') and ($_php_major == 8) {
# RedHat + PHP 8 drop the major version in apache module name.
$_lib = "${libphp_prefix}.so"
} else {
# Controls php version and libphp prefix
$_lib = $_php_major ? {
'8' => "${libphp_prefix}.so",
default => "${libphp_prefix}${php_version}.so",
}
$_lib = "${libphp_prefix}${php_version}.so"
}
$_module_id = $_php_major ? {
'5' => 'php5_module',
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@
$php_version = $facts['os']['release']['major'] ? {
'9' => '7.0', # Debian Stretch
'10' => '7.3', # Debian Buster
'16.04' => '7.0', # Ubuntu Xenial Xerus
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubuntu 16.04 is EOL and unsupported. Please keep it out.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind if I remove this commit and do a force push ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at all. In fact, that's what I do all the time.

'20.04' => '7.4', # Ubuntu Foccal Fossal
'22.04' => '8.1', # Ubuntu Jellyfish
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd imagine 22.04 is closer to Debian Bullseye. It's mostly about the mod_packages list. So I'd suggest to change line 348 with a versioncmp. Possibly Ubuntu 20.04 is also more like Debian Bullseye than this list.

Copy link
Author

@xchotard-talentsoft xchotard-talentsoft Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit I don't know exactly what the versioncmp() does here. I would use the following block code instead (from L348 to L355:

if ($facts['os']['family'] == 'Debian') {
  $php_version = $facts['os']['release']['major'] ? {
    '9'      => '7.0',  # Debian Stretch
    '10'     => '7.3',  # Debian Buster
    '11'     => '7.4',  # Debian Bullseye
    '18.04'  => '7.2',  # Ubuntu Bionic
    '20.04'  => '7.4',  # Ubuntu Focal
    '22.04'  => '8.1',  # Ubuntu Jammy
    default  => '7.4',  # Debian Bullseye, Ubuntu Focal
  }
...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree the $php_version part should be pulled out of the versioncmp and I swear I considered the exact same thing but failed to write it down. However, the list of modules can use a versioncmp. It's still not entirely correct, like #2281 should clean things up further.

default => '7.2', # Ubuntu Bionic, Cosmic and Disco
}
$mod_packages = {
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04",
"20.04"
"20.04",
"22.04"
]
},
{
Expand Down