From 9e3ee51b307bedc8003d411f0295985ebba7110f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 5 Jul 2022 12:26:22 +0200 Subject: [PATCH] Add a warning when FPM is used with MPM_PREFORK Signed-off-by: Joas Schilling --- lib/Settings/Admin/AdminSettings.php | 21 +++++++++++++++++++ .../AdminSettings/WebServerSetupChecks.vue | 15 +++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php index 34cb300987..08e151e107 100644 --- a/lib/Settings/Admin/AdminSettings.php +++ b/lib/Settings/Admin/AdminSettings.php @@ -97,6 +97,7 @@ class AdminSettings implements ISettings { $this->initialState->provideInitialState('default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_MENTION)); $this->initialState->provideInitialState('conversations_files', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files', '1')); $this->initialState->provideInitialState('conversations_files_public_shares', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1')); + $this->initialState->provideInitialState('valid_apache_php_configuration', (int) $this->validApachePHPConfiguration()); } protected function initAllowedGroups(): void { @@ -497,6 +498,26 @@ class AdminSettings implements ISettings { return $groups; } + protected function validApachePHPConfiguration(): bool { + $output = []; + @exec('apachectl -M | grep mpm', $output, $returnCode); + + if ($returnCode > 0) { + return true; + } + + $apacheModule = implode("\n", $output); + $usingFPM = ini_get('fpm.config') !== false; + + if ($usingFPM) { + // Needs to use mpm_event + return strpos($apacheModule, 'mpm_event') !== false; + } + + // Needs to use mpm_prefork + return strpos($apacheModule, 'mpm_prefork') !== false; + } + /** * @return string the section ID, e.g. 'sharing' */ diff --git a/src/components/AdminSettings/WebServerSetupChecks.vue b/src/components/AdminSettings/WebServerSetupChecks.vue index 64427bd583..9cb033c9d9 100644 --- a/src/components/AdminSettings/WebServerSetupChecks.vue +++ b/src/components/AdminSettings/WebServerSetupChecks.vue @@ -24,6 +24,11 @@ {{ t('spreed', 'Web server setup checks') }} +

+ {{ apacheWarning }} +

+