diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index e5c8a5a97ad69c42f5e757c7a41bdf9043e1b899..3e9542ba00ffb32594929804573a43a4d4925868 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -157,8 +157,18 @@ class ISPConfigDebianOS extends ISPConfigBaseOS { return $packages; } + protected function getApacheModulesToDisable() { + $modules = array( + 'mpm_prefork' + ); + if(ISPConfig::wantsPHP() !== 'system') { + array_unshift($modules, 'php8.0'); + } + return $modules; + } + 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 +784,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' ); @@ -799,6 +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 (this part could be improved) $php_versions = array( '5.6', '7.0', @@ -852,6 +862,15 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; $this->installPackages($packages); if(ISPConfig::shallInstall('web') && ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) { + // 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'; @@ -859,6 +878,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 {