From 4cd75e5ecab0700a28169eb09bc0a21f15e59c0f Mon Sep 17 00:00:00 2001 From: Thom Pol <> Date: Mon, 22 Feb 2021 19:34:36 +0100 Subject: [PATCH 1/4] Use php-fpm instead of mod_php, enable http2 (#11 and #28) --- lib/os/class.ISPConfigDebianOS.inc.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index e5c8a5a..3085d13 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -158,7 +158,7 @@ class ISPConfigDebianOS extends ISPConfigBaseOS { } protected function getApacheModulesToEnable() { - $modules = array('suexec', 'rewrite', 'ssl', 'actions', 'include', 'dav_fs', 'dav', 'auth_digest', 'cgi', 'headers', 'proxy_fcgi', 'alias'); + $modules = array('suexec', 'rewrite', 'ssl', 'actions', 'include', 'dav_fs', 'dav', 'auth_digest', 'cgi', 'headers', 'proxy_fcgi', 'alias', 'http2', 'mpm_event'); return $modules; } @@ -774,7 +774,6 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; 'apache2-utils', 'libapache2-mod-fcgid', 'apache2-suexec-pristine', - 'libapache2-mod-php', 'libapache2-mod-python', 'libapache2-mod-passenger' ); @@ -852,6 +851,15 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; $this->installPackages($packages); if(ISPConfig::shallInstall('web') && ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) { + // Disable mpm_prefork so mpm_event can be used with http2 + ISPConfigLog::info('Disabling mpm_prefork module.', true); + $modules = 'mpm_prefork'; + $cmd = 'a2dismod ' . $modules . ' 2>&1'; + $result = $this->exec($cmd); + if($result === false) { + throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); + } + ISPConfigLog::info('Enabling apache modules.', true); $modules = $this->getApacheModulesToEnable(); $cmd = 'a2enmod ' . implode(' ', $modules) . ' 2>&1'; @@ -859,6 +867,16 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; if($result === false) { throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); } + + ISPConfigLog::info('Enabling default PHP-FPM config.', true); + $conf = 'php' . $this->getSystemPHPVersion() . '-fpm'; + $cmd = 'a2enconf ' . $conf . ' 2>&1'; + $result = $this->exec($cmd); + if($result === false) { + throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); + } + + $this->restartService('apache2'); } try { -- GitLab From e99a22ee68e0ce19c397688901a4170d295fb9b9 Mon Sep 17 00:00:00 2001 From: Thom Pol <> Date: Mon, 22 Feb 2021 20:03:20 +0100 Subject: [PATCH 2/4] Disable php8.0 so mpm_event can be used (#11 and 28) --- lib/os/class.ISPConfigDebianOS.inc.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index 3085d13..6c1bdac 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -157,6 +157,12 @@ class ISPConfigDebianOS extends ISPConfigBaseOS { return $packages; } + protected function getApacheModulesToDisable() { + $modules = array('php8.0', 'mpm_prefork'); + + return $modules; + } + protected function getApacheModulesToEnable() { $modules = array('suexec', 'rewrite', 'ssl', 'actions', 'include', 'dav_fs', 'dav', 'auth_digest', 'cgi', 'headers', 'proxy_fcgi', 'alias', 'http2', 'mpm_event'); @@ -851,15 +857,15 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; $this->installPackages($packages); if(ISPConfig::shallInstall('web') && ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) { - // Disable mpm_prefork so mpm_event can be used with http2 - ISPConfigLog::info('Disabling mpm_prefork module.', true); - $modules = 'mpm_prefork'; - $cmd = 'a2dismod ' . $modules . ' 2>&1'; + // Disable conflicting modules so mpm_event can be used with http2 + ISPConfigLog::info('Disabling conflicting apache modules.', true); + $modules = $this->getApacheModulesToDisable(); + $cmd = 'a2dismod ' . implode(' ', $modules) . ' 2>&1'; $result = $this->exec($cmd); if($result === false) { throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); } - + ISPConfigLog::info('Enabling apache modules.', true); $modules = $this->getApacheModulesToEnable(); $cmd = 'a2enmod ' . implode(' ', $modules) . ' 2>&1'; -- GitLab From cc6926b34b9aa51a6904d205ae53af3d0edcf951 Mon Sep 17 00:00:00 2001 From: Thom Pol <> Date: Mon, 22 Feb 2021 20:41:17 +0100 Subject: [PATCH 3/4] Disable correct PHP version for the system (#11 and #28) --- lib/os/class.ISPConfigDebianOS.inc.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index 6c1bdac..7dc71aa 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -158,7 +158,17 @@ class ISPConfigDebianOS extends ISPConfigBaseOS { } protected function getApacheModulesToDisable() { - $modules = array('php8.0', 'mpm_prefork'); + $modules = array( + 'mpm_prefork' + ); + + if(ISPConfig::wantsPHP() === 'system') { + array_unshift($modules, 'php' . $this->getSystemPHPVersion()); + } else { + array_unshift($modules, 'php8.0'); + ); + } + } return $modules; } @@ -804,6 +814,7 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; if(ISPConfig::wantsPHP() === 'system') { $php_versions = array($this->getSystemPHPVersion()); } else { + // If a new version is added, the getApacheModulesToDisable function should be updated to disable the latest version $php_versions = array( '5.6', '7.0', -- GitLab From 2fa3ff6282380c9ea4fe7b03e906917ff0829ea2 Mon Sep 17 00:00:00 2001 From: Thom Pol <> Date: Mon, 22 Feb 2021 21:19:16 +0100 Subject: [PATCH 4/4] Fix several typo's (#11 and #28) --- lib/os/class.ISPConfigDebianOS.inc.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index 7dc71aa..3e9542b 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -161,15 +161,9 @@ class ISPConfigDebianOS extends ISPConfigBaseOS { $modules = array( 'mpm_prefork' ); - - if(ISPConfig::wantsPHP() === 'system') { - array_unshift($modules, 'php' . $this->getSystemPHPVersion()); - } else { + if(ISPConfig::wantsPHP() !== 'system') { array_unshift($modules, 'php8.0'); - ); } - } - return $modules; } @@ -814,7 +808,7 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; if(ISPConfig::wantsPHP() === 'system') { $php_versions = array($this->getSystemPHPVersion()); } else { - // If a new version is added, the getApacheModulesToDisable function should be updated to disable the latest version + // If a new version is added, the getApacheModulesToDisable function should be updated to disable the latest version (this part could be improved) $php_versions = array( '5.6', '7.0', -- GitLab