diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 7743d28f448dd..63f911af490c7 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -859,7 +859,7 @@ static int fpm_conf_process_all_pools(void) /* alert if user is not set; only if we are root and fpm is not running with --allow-to-run-as-root */ if (!wp->config->user && !geteuid() && !fpm_globals.run_as_root) { - zlog(ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name); + zlog(ZLOG_ALERT, "[pool %s] 'user' directive has not been specified when running as a root without --allow-to-run-as-root", wp->config->name); return -1; } diff --git a/sapi/fpm/tests/proc-user-not-set-when-root.phpt b/sapi/fpm/tests/proc-user-not-set-when-root.phpt new file mode 100644 index 0000000000000..4ca68b5156778 --- /dev/null +++ b/sapi/fpm/tests/proc-user-not-set-when-root.phpt @@ -0,0 +1,45 @@ +--TEST-- +FPM: Process user setting unset when running as root +--SKIPIF-- + +--FILE-- +start(envVars: [ + 'TEST_FPM_RUN_AS_ROOT' => 0, +]); +$tester->expectLogAlert( + "'user' directive has not been specified when running as a root without --allow-to-run-as-root", + 'unconfined' +); +$tester->close(); + +?> +Done +--EXPECT-- +Done +--CLEAN-- + diff --git a/sapi/fpm/tests/tester.inc b/sapi/fpm/tests/tester.inc index f486309085e6d..9079886543378 100644 --- a/sapi/fpm/tests/tester.inc +++ b/sapi/fpm/tests/tester.inc @@ -540,7 +540,7 @@ class Tester $cmd[] = '-d' . $iniEntryName . '=' . $iniEntryValue; } - if (getenv('TEST_FPM_RUN_AS_ROOT')) { + if ($envVars['TEST_FPM_RUN_AS_ROOT'] ?? getenv('TEST_FPM_RUN_AS_ROOT')) { $cmd[] = '--allow-to-run-as-root'; } $cmd = array_merge($cmd, $extraArgs);