Skip to content

Commit e1daaf5

Browse files
committed
use --localstatedir instead of separate options for pid and log files
1 parent 30de645 commit e1daaf5

File tree

4 files changed

+34
-75
lines changed

4 files changed

+34
-75
lines changed

sapi/fpm/Makefile.frag

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ install-build: install-fpm
1010
install-fpm: install-sapi
1111
@echo "Installing PHP FPM binary: $(INSTALL_ROOT)$(sbindir)/"
1212
@$(mkinstalldirs) $(INSTALL_ROOT)$(sbindir)
13-
@$(mkinstalldirs) $(INSTALL_ROOT)$(php_fpm_pid_dir)
14-
@$(mkinstalldirs) $(INSTALL_ROOT)$(php_fpm_log_dir)
13+
@$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/log
14+
@$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/run
1515
@$(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROO)$(sbindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT)
1616

1717
@echo "Installing PHP FPM config: $(INSTALL_ROOT)$(sysconfdir)/" && \

sapi/fpm/config.m4

Lines changed: 24 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,6 @@ fi
215215
dnl }}}
216216

217217
dnl configure checks {{{
218-
AC_DEFUN([AC_FPM_CHECKS],
219-
[
220-
AC_FPM_STDLIBS
221-
AC_FPM_PRCTL
222-
AC_FPM_CLOCK
223-
AC_FPM_TRACE
224-
])
225-
226218
AC_DEFUN([AC_FPM_STDLIBS],
227219
[
228220
AC_CHECK_FUNCS(setenv clearenv)
@@ -506,38 +498,38 @@ AC_DEFUN([AC_FPM_TRACE],
506498
])
507499
dnl }}}
508500

509-
dnl configure options {{{
510-
AC_DEFUN([AC_FPM_ARGS],
511-
[
512-
PHP_ARG_WITH(fpm-log,,
513-
[ --with-fpm-log[=PATH] Set the path for php-fpm log file. (default: /var/log/php-fpm.log)], yes, no)
501+
AC_MSG_CHECKING(for FPM build)
502+
if test "$PHP_FPM" != "no"; then
503+
AC_MSG_RESULT($PHP_FPM)
504+
505+
AC_LIB_EVENT([$minimum_libevent_version])
506+
507+
AC_CACHE_CHECK(whether libevent build works, php_cv_libevent_build_works, [
508+
PHP_TEST_BUILD(event_init,
509+
[
510+
php_cv_libevent_build_works=yes
511+
], [
512+
AC_MSG_RESULT(no)
513+
AC_MSG_ERROR([build test failed. Please check the config.log for details.])
514+
], $LIBEVENT_LIBS)
515+
])
514516

515-
PHP_ARG_WITH(fpm-pid,,
516-
[ --with-fpm-pid[=PATH] Set the path for php-fpm pid file. (default: /var/run/php-fpm.pid)], yes, no)
517+
PHP_SETUP_LIBXML(FPM_SHARED_LIBADD, [
518+
], [
519+
AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
520+
])
521+
522+
AC_FPM_STDLIBS
523+
AC_FPM_PRCTL
524+
AC_FPM_CLOCK
525+
AC_FPM_TRACE
517526

518527
PHP_ARG_WITH(fpm-user,,
519528
[ --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody)], nobody, no)
520529

521530
PHP_ARG_WITH(fpm-group,,
522531
[ --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this
523532
should usually be set to match the fpm username (default: nobody)], nobody, no)
524-
])
525-
526-
AC_DEFUN([AC_FPM_VARS],
527-
[
528-
if test -z "$PHP_FPM_LOG" -o "$PHP_FPM_LOG" = "yes" -o "$PHP_FPM_LOG" = "no"; then
529-
php_fpm_log_path="/var/log/php-fpm.log"
530-
else
531-
php_fpm_log_path="$PHP_FPM_LOG"
532-
fi
533-
php_fpm_log_dir=`dirname $php_fpm_log_path`
534-
535-
if test -z "$PHP_FPM_PID" -o "$PHP_FPM_PID" = "yes" -o "$PHP_FPM_PID" = "no"; then
536-
php_fpm_pid_path="/var/run/php-fpm.pid"
537-
else
538-
php_fpm_pid_path="$PHP_FPM_PID"
539-
fi
540-
php_fpm_pid_dir=`dirname $php_fpm_pid_path`
541533

542534
if test -z "$PHP_FPM_USER" -o "$PHP_FPM_USER" = "yes" -o "$PHP_FPM_USER" = "no"; then
543535
php_fpm_user="nobody"
@@ -551,51 +543,14 @@ AC_DEFUN([AC_FPM_VARS],
551543
php_fpm_group="$PHP_FPM_GROUP"
552544
fi
553545

554-
555546
PHP_SUBST_OLD(fpm_version)
556-
PHP_SUBST_OLD(php_fpm_log_path)
557-
PHP_SUBST_OLD(php_fpm_pid_path)
558-
PHP_SUBST_OLD(php_fpm_log_dir)
559-
PHP_SUBST_OLD(php_fpm_pid_dir)
560547
PHP_SUBST_OLD(php_fpm_user)
561548
PHP_SUBST_OLD(php_fpm_group)
562549

563550
AC_DEFINE_UNQUOTED(PHP_FPM_VERSION, "$fpm_version", [fpm version])
564-
AC_DEFINE_UNQUOTED(PHP_FPM_LOG_PATH, "$php_fpm_log_path", [fpm log file path])
565-
AC_DEFINE_UNQUOTED(PHP_FPM_PID_PATH, "$php_fpm_pid_path", [fpm pid file path])
566551
AC_DEFINE_UNQUOTED(PHP_FPM_USER, "$php_fpm_user", [fpm user name])
567552
AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name])
568553

569-
])
570-
571-
dnl }}}
572-
573-
574-
AC_MSG_CHECKING(for FPM build)
575-
if test "$PHP_FPM" != "no"; then
576-
AC_MSG_RESULT($PHP_FPM)
577-
578-
AC_LIB_EVENT([$minimum_libevent_version])
579-
580-
AC_CACHE_CHECK(whether libevent build works, php_cv_libevent_build_works, [
581-
PHP_TEST_BUILD(event_init,
582-
[
583-
php_cv_libevent_build_works=yes
584-
], [
585-
AC_MSG_RESULT(no)
586-
AC_MSG_ERROR([build test failed. Please check the config.log for details.])
587-
], $LIBEVENT_LIBS)
588-
])
589-
590-
PHP_SETUP_LIBXML(FPM_SHARED_LIBADD, [
591-
], [
592-
AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
593-
])
594-
595-
AC_FPM_CHECKS
596-
AC_FPM_ARGS
597-
AC_FPM_VARS
598-
599554
PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.1)
600555
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag], [$abs_srcdir/sapi/fpm], [sapi/fpm])
601556

sapi/fpm/fpm/fpm_conf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,11 @@ static int fpm_conf_post_process() /* {{{ */
518518
}
519519

520520
if (!fpm_global_config.error_log) {
521-
fpm_global_config.error_log = strdup(PHP_FPM_LOG_PATH);
521+
char *tmp_log_path;
522+
523+
spprintf(&tmp_log_path, 0, "%s/log/php-fpm.log", PHP_LOCALSTATEDIR);
524+
fpm_global_config.error_log = strdup(tmp_log_path);
525+
efree(tmp_log_path);
522526
}
523527

524528
fpm_evaluate_full_path(&fpm_global_config.error_log);

sapi/fpm/php-fpm.conf.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
<section name="global_options">
77

88
Pid file
9-
<value name="pid_file">@php_fpm_pid_path@</value>
9+
<value name="pid_file">@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid</value>
1010

1111
Error log file
12-
<value name="error_log">@php_fpm_log_path@</value>
12+
<value name="error_log">@EXPANDED_LOCALSTATEDIR@/log/php-fpm.log</value>
1313

1414
Log level
1515
<value name="log_level">notice</value>
@@ -110,7 +110,7 @@
110110
<value name="request_slowlog_timeout">0s</value>
111111

112112
The log file for slow requests
113-
<value name="slowlog">@php_fpm_log_path@.slow</value>
113+
<value name="slowlog">@EXPANDED_LOCALSTATEDIR@/log/php-fpm.log.slow</value>
114114

115115
Set open file desc rlimit
116116
<value name="rlimit_files">1024</value>

0 commit comments

Comments
 (0)