Skip to content

Commit fb49f13

Browse files
goohJulien Pauli
authored andcommitted
Fix #72575: using --allow-to-run-as-root should ignore missing user
directive Trying to start PHP-FPM with the --allow-to-run-as-root flag will not work when the user directive is not given in the FPM worker pool configuration. Parsing the config will fail. Consequently, FPM cannot start. The check is in place to prevent FPM from getting started with root privileges by accident. Prior to #61295 the check would also prevent any non-root user to start PHP-FPM without a user directive present. This patch adds an additional check to the config parser, checking for the --allow-to-run-as-root flag to be present. If so, parsing will no longer abort for root users even if the user directive is missing. I will also update the PHP docs since they still state the user directive is a mandatory setting which it is not since #61295.
1 parent d2d17e1 commit fb49f13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sapi/fpm/fpm/fpm_conf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,8 @@ static int fpm_conf_process_all_pools() /* {{{ */
763763
}
764764
}
765765

766-
/* alert if user is not set only if we are not root*/
767-
if (!wp->config->user && !geteuid()) {
766+
/* alert if user is not set; only if we are root and fpm is not running with --allow-to-run-as-root */
767+
if (!wp->config->user && !geteuid() && !fpm_globals.run_as_root) {
768768
zlog(ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name);
769769
return -1;
770770
}

0 commit comments

Comments
 (0)