Skip to content

Commit

Permalink
Merge pull request #7516 from nextcloud/bugfix/7499/fpm-prefork-warning
Browse files Browse the repository at this point in the history
Add a warning when FPM is used with MPM_PREFORK
  • Loading branch information
nickvergessen authored Jul 6, 2022
2 parents d9b7a3f + 9e3ee51 commit 076db31
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/Settings/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected function initGeneralSettings(): void {
$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 {
Expand Down Expand Up @@ -497,6 +498,26 @@ protected function getGroupDetailsArray(array $gids, string $configKey): array {
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'
*/
Expand Down
15 changes: 15 additions & 0 deletions src/components/AdminSettings/WebServerSetupChecks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
{{ t('spreed', 'Web server setup checks') }}
</h2>

<p v-if="!validApachePHPConfiguration"
class="settings-hint warning">
{{ apacheWarning }}
</p>

<ul class="web-server-setup-checks">
<li class="background-blur">
{{ t('spreed', 'Files required for background blur can be loaded') }}
Expand Down Expand Up @@ -55,6 +60,7 @@ import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import { VIRTUAL_BACKGROUND_TYPE } from '../../utils/media/effects/virtual-background/constants.js'
import JitsiStreamBackgroundEffect from '../../utils/media/effects/virtual-background/JitsiStreamBackgroundEffect.js'
import VirtualBackground from '../../utils/media/pipeline/VirtualBackground.js'
import { loadState } from '@nextcloud/initial-state'
export default {
name: 'WebServerSetupChecks',
Expand All @@ -66,6 +72,7 @@ export default {
data() {
return {
backgroundBlurLoaded: undefined,
validApachePHPConfiguration: true,
}
},
Expand Down Expand Up @@ -109,6 +116,14 @@ export default {
return t('spreed', 'Checking …')
},
apacheWarning() {
return t('spreed', 'It seems that the PHP and Apache configuration is not compatible. Please note that PHP can only be used with the MPM_PREFORK module and PHP-FPM can only be used with the MPM_EVENT module.')
},
},
mounted() {
this.validApachePHPConfiguration = parseInt(loadState('spreed', 'valid_apache_php_configuration')) === 1
},
beforeMount() {
Expand Down

0 comments on commit 076db31

Please sign in to comment.