diff options
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/fpm/config.m4 | 6 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm.c | 6 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm.h | 4 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_conf.c | 11 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_conf.h | 2 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 34 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_signals.c | 12 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_signals.h | 3 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_status.c | 18 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_unix.c | 91 | ||||
| -rw-r--r-- | sapi/fpm/init.d.php-fpm.in | 4 | ||||
| -rw-r--r-- | sapi/fpm/php-fpm.8.in | 23 | ||||
| -rw-r--r-- | sapi/fpm/php-fpm.service.in | 12 |
13 files changed, 142 insertions, 84 deletions
diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index ad46717acd..6191c329ba 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -587,12 +587,16 @@ if test "$PHP_FPM" != "no"; then AC_DEFINE_UNQUOTED(PHP_FPM_USER, "$php_fpm_user", [fpm user name]) AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name]) + AC_DEFINE_UNQUOTED(PHP_FPM_USER, "$php_fpm_user", [fpm user name]) + AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name]) + PHP_ADD_BUILD_DIR(sapi/fpm/fpm) PHP_ADD_BUILD_DIR(sapi/fpm/fpm/events) - PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.8 sapi/fpm/status.html) + PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html) PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag]) SAPI_FPM_PATH=sapi/fpm/php-fpm + if test "$fpm_trace_type" && test -f "$abs_srcdir/sapi/fpm/fpm/fpm_trace_$fpm_trace_type.c"; then PHP_FPM_TRACE_FILES="fpm/fpm_trace.c fpm/fpm_trace_$fpm_trace_type.c" diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index dab415d123..b866f37f2d 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -39,10 +39,10 @@ struct fpm_globals_s fpm_globals = { .test_successful = 0, .heartbeat = 0, .run_as_root = 0, - .send_config_signal = 0, + .send_config_pipe = {0, 0}, }; -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */ +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon) /* {{{ */ { fpm_globals.argc = argc; fpm_globals.argv = argv; @@ -55,7 +55,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t if (0 > fpm_php_init_main() || 0 > fpm_stdio_init_main() || - 0 > fpm_conf_init_main(test_conf) || + 0 > fpm_conf_init_main(test_conf, force_daemon) || 0 > fpm_unix_init_main() || 0 > fpm_scoreboard_init_main() || 0 > fpm_pctl_init_main() || diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index 7a2903d07d..65d0e0d691 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -37,7 +37,7 @@ int fpm_run(int *max_requests); -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root); +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon); struct fpm_globals_s { pid_t parent_pid; @@ -55,7 +55,7 @@ struct fpm_globals_s { int test_successful; int heartbeat; int run_as_root; - int send_config_signal; + int send_config_pipe[2]; }; extern struct fpm_globals_s fpm_globals; diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index dfe6792c05..25e2cc43a1 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -1115,7 +1115,7 @@ int fpm_conf_write_pid() /* {{{ */ } /* }}} */ -static int fpm_conf_post_process(TSRMLS_D) /* {{{ */ +static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */ { struct fpm_worker_pool_s *wp; @@ -1123,6 +1123,11 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */ fpm_evaluate_full_path(&fpm_global_config.pid_file, NULL, PHP_LOCALSTATEDIR, 0); } + if (force_daemon >= 0) { + /* forced from command line options */ + fpm_global_config.daemonize = force_daemon; + } + fpm_globals.log_level = fpm_global_config.log_level; if (fpm_global_config.process_max < 0) { @@ -1584,7 +1589,7 @@ static void fpm_conf_dump() /* {{{ */ } /* }}} */ -int fpm_conf_init_main(int test_conf) /* {{{ */ +int fpm_conf_init_main(int test_conf, int force_daemon) /* {{{ */ { int ret; TSRMLS_FETCH(); @@ -1630,7 +1635,7 @@ int fpm_conf_init_main(int test_conf) /* {{{ */ return -1; } - if (0 > fpm_conf_post_process(TSRMLS_C)) { + if (0 > fpm_conf_post_process(force_daemon TSRMLS_CC)) { zlog(ZLOG_ERROR, "failed to post process the configuration"); return -1; } diff --git a/sapi/fpm/fpm/fpm_conf.h b/sapi/fpm/fpm/fpm_conf.h index f780f03891..dc54133d43 100644 --- a/sapi/fpm/fpm/fpm_conf.h +++ b/sapi/fpm/fpm/fpm_conf.h @@ -97,7 +97,7 @@ enum { PM_STYLE_ONDEMAND = 3 }; -int fpm_conf_init_main(int test_conf); +int fpm_conf_init_main(int test_conf, int force_daemon); int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc); int fpm_conf_write_pid(); int fpm_conf_unlink_pid(); diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index cdec235bdd..edd75be5ae 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -155,6 +155,8 @@ static const opt_struct OPTIONS[] = { {'p', 1, "prefix"}, {'g', 1, "pid"}, {'R', 0, "allow-to-run-as-root"}, + {'D', 0, "daemonize"}, + {'F', 0, "nodaemonize"}, {'-', 0, NULL} /* end of args */ }; @@ -912,7 +914,7 @@ static void php_cgi_usage(char *argv0) prog = "php"; } - php_printf( "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>]\n" + php_printf( "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>] [-D] [-F]\n" " -c <path>|<file> Look for php.ini file in this directory\n" " -n No php.ini file will be used\n" " -d foo[=bar] Define INI entry foo with value 'bar'\n" @@ -928,6 +930,9 @@ static void php_cgi_usage(char *argv0) " -y, --fpm-config <file>\n" " Specify alternative path to FastCGI process manager config file.\n" " -t, --test Test FPM configuration and exit\n" + " -D, --daemonize force to run in background, and ignore daemonize option from config file\n" + " -F, --nodaemonize\n" + " force to stay in foreground, and ignore daemonize option from config file\n" " -R, --allow-to-run-as-root\n" " Allow pool to run as root (disabled by default)\n", prog, PHP_PREFIX); @@ -1550,6 +1555,7 @@ int main(int argc, char *argv[]) char *fpm_prefix = NULL; char *fpm_pid = NULL; int test_conf = 0; + int force_daemon = -1; int php_information = 0; int php_allow_to_run_as_root = 0; @@ -1670,6 +1676,14 @@ int main(int argc, char *argv[]) php_allow_to_run_as_root = 1; break; + case 'D': /* daemonize */ + force_daemon = 1; + break; + + case 'F': /* nodaemonize */ + force_daemon = 0; + break; + default: case 'h': case '?': @@ -1797,18 +1811,22 @@ consult the installation file that came with this distribution, or visit \n\ } } - if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root)) { + if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root, force_daemon)) { - if (fpm_globals.send_config_signal) { - zlog(ZLOG_DEBUG, "Sending SIGUSR2 (error) to parent %d", getppid()); - kill(getppid(), SIGUSR2); + if (fpm_globals.send_config_pipe[1]) { + int writeval = 0; + zlog(ZLOG_DEBUG, "Sending \"0\" (error) to parent via fd=%d", fpm_globals.send_config_pipe[1]); + write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval)); + close(fpm_globals.send_config_pipe[1]); } return FPM_EXIT_CONFIG; } - if (fpm_globals.send_config_signal) { - zlog(ZLOG_DEBUG, "Sending SIGUSR1 (OK) to parent %d", getppid()); - kill(getppid(), SIGUSR1); + if (fpm_globals.send_config_pipe[1]) { + int writeval = 1; + zlog(ZLOG_DEBUG, "Sending \"1\" (OK) to parent via fd=%d", fpm_globals.send_config_pipe[1]); + write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval)); + close(fpm_globals.send_config_pipe[1]); } fpm_is_running = 1; diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c index 656269f1a3..8993a860ae 100644 --- a/sapi/fpm/fpm/fpm_signals.c +++ b/sapi/fpm/fpm/fpm_signals.c @@ -249,15 +249,3 @@ int fpm_signals_get_fd() /* {{{ */ } /* }}} */ -void fpm_signals_sighandler_exit_ok(pid_t pid) /* {{{ */ -{ - exit(FPM_EXIT_OK); -} -/* }}} */ - -void fpm_signals_sighandler_exit_config(pid_t pid) /* {{{ */ -{ - exit(FPM_EXIT_CONFIG); -} -/* }}} */ - diff --git a/sapi/fpm/fpm/fpm_signals.h b/sapi/fpm/fpm/fpm_signals.h index 13484cbac2..eb80faecfd 100644 --- a/sapi/fpm/fpm/fpm_signals.h +++ b/sapi/fpm/fpm/fpm_signals.h @@ -11,9 +11,6 @@ int fpm_signals_init_main(); int fpm_signals_init_child(); int fpm_signals_get_fd(); -void fpm_signals_sighandler_exit_ok(pid_t pid); -void fpm_signals_sighandler_exit_config(pid_t pid); - extern const char *fpm_signal_names[NSIG + 1]; #endif diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index b9b9a8c0b6..2363b57f80 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -148,7 +148,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "<tr><th>start time</th><td>%s</td></tr>\n" "<tr><th>start since</th><td>%lu</td></tr>\n" "<tr><th>accepted conn</th><td>%lu</td></tr>\n" -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "<tr><th>listen queue</th><td>%u</td></tr>\n" "<tr><th>max listen queue</th><td>%u</td></tr>\n" "<tr><th>listen queue len</th><td>%d</td></tr>\n" @@ -178,7 +178,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "<th>content length</th>" "<th>user</th>" "<th>script</th>" -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "<th>last request cpu</th>" #endif "<th>last request memory</th>" @@ -197,7 +197,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "<td>%zu</td>" "<td>%s</td>" "<td>%s</td>" -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "<td>%.2f</td>" #endif "<td>%zu</td>" @@ -220,7 +220,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "<start-time>%s</start-time>\n" "<start-since>%lu</start-since>\n" "<accepted-conn>%lu</accepted-conn>\n" -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "<listen-queue>%u</listen-queue>\n" "<max-listen-queue>%u</max-listen-queue>\n" "<listen-queue-len>%d</listen-queue-len>\n" @@ -249,7 +249,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "<content-length>%zu</content-length>" "<user>%s</user>" "<script>%s</script>" -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "<last-request-cpu>%.2f</last-request-cpu>" #endif "<last-request-memory>%zu</last-request-memory>" @@ -270,7 +270,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "\"start time\":%s," "\"start since\":%lu," "\"accepted conn\":%lu," -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "\"listen queue\":%u," "\"max listen queue\":%u," "\"listen queue len\":%d," @@ -300,7 +300,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "\"content length\":%zu," "\"user\":\"%s\"," "\"script\":\"%s\"," -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "\"last request cpu\":%.2f," #endif "\"last request memory\":%zu" @@ -320,7 +320,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ "start time: %s\n" "start since: %lu\n" "accepted conn: %lu\n" -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ "listen queue: %u\n" "max listen queue: %u\n" "listen queue len: %d\n" @@ -362,7 +362,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ time_buffer, now_epoch - scoreboard.start_epoch, scoreboard.requests, -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ scoreboard.lq, scoreboard.lq_max, scoreboard.lq_len, diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 5c5e37c3a4..48249e8a49 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -121,16 +121,16 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */ } } else { /* not root */ if (wp->config->user && *wp->config->user) { - zlog(ZLOG_WARNING, "[pool %s] 'user' directive is ignored when FPM is not running as root", wp->config->name); + zlog(ZLOG_NOTICE, "[pool %s] 'user' directive is ignored when FPM is not running as root", wp->config->name); } if (wp->config->group && *wp->config->group) { - zlog(ZLOG_WARNING, "[pool %s] 'group' directive is ignored when FPM is not running as root", wp->config->name); + zlog(ZLOG_NOTICE, "[pool %s] 'group' directive is ignored when FPM is not running as root", wp->config->name); } if (wp->config->chroot && *wp->config->chroot) { - zlog(ZLOG_WARNING, "[pool %s] 'chroot' directive is ignored when FPM is not running as root", wp->config->name); + zlog(ZLOG_NOTICE, "[pool %s] 'chroot' directive is ignored when FPM is not running as root", wp->config->name); } if (wp->config->process_priority != 64) { - zlog(ZLOG_WARNING, "[pool %s] 'process.priority' directive is ignored when FPM is not running as root", wp->config->name); + zlog(ZLOG_NOTICE, "[pool %s] 'process.priority' directive is ignored when FPM is not running as root", wp->config->name); } /* set up HOME and USER anyway */ @@ -262,36 +262,19 @@ int fpm_unix_init_main() /* {{{ */ * The parent process has then to wait for the master * process to initialize to return a consistent exit * value. For this pupose, the master process will - * send USR1 if everything went well and USR2 - * otherwise. + * send \"1\" into the pipe if everything went well + * and \"0\" otherwise. */ - struct sigaction act; - struct sigaction oldact_usr1; - struct sigaction oldact_usr2; - struct timeval tv; - /* - * set sigaction for USR1 before fork - * save old sigaction to restore it after - * fork in the child process (the master process) - */ - memset(&act, 0, sizeof(act)); - memset(&act, 0, sizeof(oldact_usr1)); - act.sa_handler = fpm_signals_sighandler_exit_ok; - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, &oldact_usr1); + struct timeval tv; + fd_set rfds; + int ret; - /* - * set sigaction for USR2 before fork - * save old sigaction to restore it after - * fork in the child process (the master process) - */ - memset(&act, 0, sizeof(act)); - memset(&act, 0, sizeof(oldact_usr2)); - act.sa_handler = fpm_signals_sighandler_exit_config; - sigfillset(&act.sa_mask); - sigaction(SIGUSR2, &act, &oldact_usr2); + if (pipe(fpm_globals.send_config_pipe) == -1) { + zlog(ZLOG_SYSERROR, "failed to create pipe"); + return -1; + } /* then fork */ pid_t pid = fork(); @@ -302,24 +285,54 @@ int fpm_unix_init_main() /* {{{ */ return -1; case 0 : /* children */ - /* restore USR1 and USR2 sigaction */ - sigaction(SIGUSR1, &oldact_usr1, NULL); - sigaction(SIGUSR2, &oldact_usr2, NULL); - fpm_globals.send_config_signal = 1; + close(fpm_globals.send_config_pipe[0]); /* close the read side of the pipe */ break; default : /* parent */ - fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT); + close(fpm_globals.send_config_pipe[1]); /* close the write side of the pipe */ /* * wait for 10s before exiting with error - * the child is supposed to send USR1 or USR2 to tell the parent + * the child is supposed to send 1 or 0 into the pipe to tell the parent * how it goes for it */ + FD_ZERO(&rfds); + FD_SET(fpm_globals.send_config_pipe[0], &rfds); + tv.tv_sec = 10; tv.tv_usec = 0; - zlog(ZLOG_DEBUG, "The calling process is waiting for the master process to ping"); - select(0, NULL, NULL, NULL, &tv); + + zlog(ZLOG_DEBUG, "The calling process is waiting for the master process to ping via fd=%d", fpm_globals.send_config_pipe[0]); + ret = select(fpm_globals.send_config_pipe[0] + 1, &rfds, NULL, NULL, &tv); + if (ret == -1) { + zlog(ZLOG_SYSERROR, "failed to select"); + exit(FPM_EXIT_SOFTWARE); + } + if (ret) { /* data available */ + int readval; + ret = read(fpm_globals.send_config_pipe[0], &readval, sizeof(readval)); + if (ret == -1) { + zlog(ZLOG_SYSERROR, "failed to read from pipe"); + exit(FPM_EXIT_SOFTWARE); + } + + if (ret == 0) { + zlog(ZLOG_ERROR, "no data have been read from pipe"); + exit(FPM_EXIT_SOFTWARE); + } else { + if (readval == 1) { + zlog(ZLOG_DEBUG, "I received a valid acknoledge from the master process, I can exit without error"); + fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT); + exit(FPM_EXIT_OK); + } else { + zlog(ZLOG_DEBUG, "The master process returned an error !"); + exit(FPM_EXIT_SOFTWARE); + } + } + } else { /* no date sent ! */ + zlog(ZLOG_ERROR, "the master process didn't send back its status (via the pipe to the calling process)"); + exit(FPM_EXIT_SOFTWARE); + } exit(FPM_EXIT_SOFTWARE); } } @@ -337,7 +350,7 @@ int fpm_unix_init_main() /* {{{ */ return -1; } } else { - zlog(ZLOG_WARNING, "'process.priority' directive is ignored when FPM is not running as root"); + zlog(ZLOG_NOTICE, "'process.priority' directive is ignored when FPM is not running as root"); } } diff --git a/sapi/fpm/init.d.php-fpm.in b/sapi/fpm/init.d.php-fpm.in index dc66310c3d..49cce79ae9 100644 --- a/sapi/fpm/init.d.php-fpm.in +++ b/sapi/fpm/init.d.php-fpm.in @@ -18,7 +18,7 @@ php_fpm_CONF=@sysconfdir@/php-fpm.conf php_fpm_PID=@localstatedir@/run/php-fpm.pid -php_opts="--fpm-config $php_fpm_CONF" +php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID" wait_for_pid () { @@ -54,7 +54,7 @@ case "$1" in start) echo -n "Starting php-fpm " - $php_fpm_BIN $php_opts + $php_fpm_BIN --daemonize $php_opts if [ "$?" != 0 ] ; then echo " failed" diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in index 6c9c6d6274..a4e7e74e20 100644 --- a/sapi/fpm/php-fpm.8.in +++ b/sapi/fpm/php-fpm.8.in @@ -99,6 +99,20 @@ Test FPM configuration file and exit If called twice (-tt), the configuration is dumped before exiting. .TP .PD 0 +.B \-\-daemonize +.TP +.PD 1 +.B \-D +Force to run in background and ignore daemonize option from configuration file. +.TP +.PD 0 +.B \-\-nodaemonize +.TP +.PD 1 +.B \-F +Force to stay in foreground and ignore daemonize option from configuration file. +.TP +.PD 0 .B \-\-zend\-extension \fIfile\fP .TP .PD 1 @@ -113,13 +127,20 @@ The configuration file for the php-fpm daemon. .B php.ini The standard php configuration file. .SH EXAMPLES -You should use the init script provided to start and stop the php-fpm daemon. This situation applies for any unix systems which use init.d for their main process manager. +For any unix systems which use init.d for their main process manager, you should use the init script provided to start and stop the php-fpm daemon. .P .PD 1 .RS sudo /etc/init.d/php-fpm start .RE .TP +For any unix systems which use systemd for their main process manager, you should use the unit file provided to start and stop the php-fpm daemon. +.P +.PD 1 +.RS +sudo systemctl start php-fpm.service +.RE +.TP If your installation has no appropriate init script, launch php-fpm with no arguments. It will launch as a daemon (background process) by default. The file @php_fpm_localstatedir@/run/php-fpm.pid determines whether php-fpm is already up and running. Once started, php-fpm then responds to several POSIX signals: .P .PD 0 diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in new file mode 100644 index 0000000000..396a88d66f --- /dev/null +++ b/sapi/fpm/php-fpm.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=The PHP FastCGI Process Manager +After=syslog.target network.target + +[Service] +PIDFile=@localstatedir@/run/php-fpm.pid +ExecStart=@sbindir@/php-fpm --nodaemonize --fpm-config @sysconfdir@/php-fpm.conf +ExecReload=/bin/kill -USR2 $MAINPID + +[Install] +WantedBy=multi-user.target + |
