From b735e2b3405e6d67de7f5f02cc52a3b29397d605 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 1 Oct 2012 15:19:32 +0200 Subject: php 5.4: sync with rawhide --- php-5.4.7-63085.patch | 236 ------------------------------------- php-5.4.7-fpm-systemd.patch | 279 ++++++++++++++++++++++++++++++++++++++++++++ php-5.4.7-fpm.patch | 223 +++++++++++++++++++++++++++++++++++ php-5.4.7-imap.patch | 11 ++ php-5.4.7-odbctimer.patch | 58 +++++++++ php-5.4.7-sqlite.patch | 27 +++++ php-fpm.service | 1 + php54.spec | 80 ++++++++++--- 8 files changed, 665 insertions(+), 250 deletions(-) delete mode 100644 php-5.4.7-63085.patch create mode 100644 php-5.4.7-fpm-systemd.patch create mode 100644 php-5.4.7-fpm.patch create mode 100644 php-5.4.7-imap.patch create mode 100644 php-5.4.7-odbctimer.patch create mode 100644 php-5.4.7-sqlite.patch diff --git a/php-5.4.7-63085.patch b/php-5.4.7-63085.patch deleted file mode 100644 index b5d2ff6..0000000 --- a/php-5.4.7-63085.patch +++ /dev/null @@ -1,236 +0,0 @@ -diff -Nru sapi/fpm.old/config.m4 sapi/fpm/config.m4 ---- sapi/fpm.old/config.m4 2012-09-19 15:53:48.001758347 +0200 -+++ sapi/fpm/config.m4 2012-09-19 16:18:57.661936394 +0200 -@@ -589,7 +589,7 @@ - - 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 -diff -Nru sapi/fpm.old/fpm/fpm.c sapi/fpm/fpm/fpm.c ---- sapi/fpm.old/fpm/fpm.c 2012-09-19 15:53:48.000758297 +0200 -+++ sapi/fpm/fpm/fpm.c 2012-09-19 16:09:57.462102346 +0200 -@@ -42,7 +42,7 @@ - .send_config_signal = 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 @@ - - 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 -Nru sapi/fpm.old/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.c ---- sapi/fpm.old/fpm/fpm_conf.c 2012-09-19 15:53:48.000758297 +0200 -+++ sapi/fpm/fpm/fpm_conf.c 2012-09-19 16:08:46.034854345 +0200 -@@ -1115,7 +1115,7 @@ - } - /* }}} */ - --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 @@ - 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 @@ - } - /* }}} */ - --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 @@ - 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 -Nru sapi/fpm.old/fpm/fpm_conf.h sapi/fpm/fpm/fpm_conf.h ---- sapi/fpm.old/fpm/fpm_conf.h 2012-09-19 15:53:48.000758297 +0200 -+++ sapi/fpm/fpm/fpm_conf.h 2012-09-19 16:05:29.874174589 +0200 -@@ -97,7 +97,7 @@ - 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 -Nru sapi/fpm.old/fpm/fpm.h sapi/fpm/fpm/fpm.h ---- sapi/fpm.old/fpm/fpm.h 2012-09-19 15:53:48.000758297 +0200 -+++ sapi/fpm/fpm/fpm.h 2012-09-19 16:02:06.113470905 +0200 -@@ -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; -diff -Nru sapi/fpm.old/fpm/fpm_main.c sapi/fpm/fpm/fpm_main.c ---- sapi/fpm.old/fpm/fpm_main.c 2012-09-19 15:53:47.999758244 +0200 -+++ sapi/fpm/fpm/fpm_main.c 2012-09-19 16:29:52.595853439 +0200 -@@ -155,6 +155,8 @@ - {'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 @@ - prog = "php"; - } - -- php_printf( "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p ] [-g ] [-c ] [-d foo[=bar]] [-y ]\n" -+ php_printf( "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p ] [-g ] [-c ] [-d foo[=bar]] [-y ] [-D] [-F]\n" - " -c | 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 @@ - " -y, --fpm-config \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 @@ - 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 @@ - 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,7 +1811,7 @@ - } - } - -- 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()); -diff -Nru sapi/fpm.old/init.d.php-fpm.in sapi/fpm/init.d.php-fpm.in ---- sapi/fpm.old/init.d.php-fpm.in 2012-09-19 15:53:47.998758183 +0200 -+++ sapi/fpm/init.d.php-fpm.in 2012-09-19 16:12:13.356570094 +0200 -@@ -54,7 +54,7 @@ - start) - echo -n "Starting php-fpm " - -- $php_fpm_BIN $php_opts -+ $php_fpm_BIN --daemonize $php_opts - - if [ "$?" != 0 ] ; then - echo " failed" -diff -Nru sapi/fpm.old/php-fpm.8.in sapi/fpm/php-fpm.8.in ---- sapi/fpm.old/php-fpm.8.in 2012-09-19 15:53:47.998758183 +0200 -+++ sapi/fpm/php-fpm.8.in 2012-09-19 16:40:57.865863325 +0200 -@@ -99,6 +99,20 @@ - 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 @@ - .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 -Nru sapi/fpm.old/php-fpm.service.in sapi/fpm/php-fpm.service.in ---- sapi/fpm.old/php-fpm.service.in 1970-01-01 01:00:00.000000000 +0100 -+++ sapi/fpm/php-fpm.service.in 2012-09-19 16:21:32.140467558 +0200 -@@ -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 -+ diff --git a/php-5.4.7-fpm-systemd.patch b/php-5.4.7-fpm-systemd.patch new file mode 100644 index 0000000..0cbe96f --- /dev/null +++ b/php-5.4.7-fpm-systemd.patch @@ -0,0 +1,279 @@ +From 851a04bb7b680954249e825ea3fef420f7d66bb7 Mon Sep 17 00:00:00 2001 +From: Jerome Loyet +Date: Fri, 28 Sep 2012 00:33:05 +0200 +Subject: [PATCH] - Fixed bug #63085 (Systemd integration and daemonize) + +--- + NEWS | 1 + + sapi/fpm/config.m4 | 2 +- + sapi/fpm/fpm/fpm.c | 4 ++-- + sapi/fpm/fpm/fpm.h | 2 +- + sapi/fpm/fpm/fpm_conf.c | 11 ++++++++--- + sapi/fpm/fpm/fpm_conf.h | 2 +- + sapi/fpm/fpm/fpm_main.c | 18 ++++++++++++++++-- + sapi/fpm/init.d.php-fpm.in | 2 +- + sapi/fpm/php-fpm.8.in | 23 ++++++++++++++++++++++- + 9 files changed, 53 insertions(+), 12 deletions(-) + +diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 +index c23485a..7687660 100644 +--- a/sapi/fpm/config.m4 ++++ b/sapi/fpm/config.m4 +@@ -589,7 +589,7 @@ + + 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 +diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c +index 2f42175..b866f37 100644 +--- a/sapi/fpm/fpm/fpm.c ++++ b/sapi/fpm/fpm/fpm.c +@@ -42,7 +42,7 @@ struct fpm_globals_s fpm_globals = { + .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 c576876..65d0e0d 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; +diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c +index dfe6792..25e2cc4 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 f780f03..dc54133 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 70e917a..3faf308 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -155,6 +155,8 @@ + {'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 @@ + prog = "php"; + } + +- php_printf( "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p ] [-g ] [-c ] [-d foo[=bar]] [-y ]\n" ++ php_printf( "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p ] [-g ] [-c ] [-d foo[=bar]] [-y ] [-D] [-F]\n" + " -c | 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 @@ + " -y, --fpm-config \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 @@ + 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 @@ + 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,7 +1811,7 @@ + } + } + +- 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_pipe[1]) { + int writeval = 0; +diff --git a/sapi/fpm/init.d.php-fpm.in b/sapi/fpm/init.d.php-fpm.in +index dc66310..3edd64f 100644 +--- a/sapi/fpm/init.d.php-fpm.in ++++ b/sapi/fpm/init.d.php-fpm.in +@@ -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 6c9c6d6..a4e7e74 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 +-- +1.7.8 + +From 2259a8f18b1f25c175c486f54849fcd9e61ecde1 Mon Sep 17 00:00:00 2001 +From: Jerome Loyet +Date: Fri, 28 Sep 2012 00:47:56 +0200 +Subject: [PATCH] - add missing php-fpm.service.in + +--- + sapi/fpm/php-fpm.service.in | 12 ++++++++++++ + 1 files changed, 12 insertions(+), 0 deletions(-) + create mode 100644 sapi/fpm/php-fpm.service.in + +diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in +new file mode 100644 +index 0000000..396a88d +--- /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 ++ +-- +1.7.8 + diff --git a/php-5.4.7-fpm.patch b/php-5.4.7-fpm.patch new file mode 100644 index 0000000..f237876 --- /dev/null +++ b/php-5.4.7-fpm.patch @@ -0,0 +1,223 @@ +From b5eb1456aa17e83b7b734dfc2316d632c9adcc6c Mon Sep 17 00:00:00 2001 +From: Jerome Loyet +Date: Fri, 28 Sep 2012 00:05:48 +0200 +Subject: [PATCH] - Fixed bug #62954 (startup problems fpm / php-fpm) - Fixed + bug #62886 (PHP-FPM may segfault/hang on startup) + +--- + NEWS | 4 ++ + sapi/fpm/fpm/fpm.c | 2 +- + sapi/fpm/fpm/fpm.h | 2 +- + sapi/fpm/fpm/fpm_main.c | 16 +++++--- + sapi/fpm/fpm/fpm_signals.c | 12 ------ + sapi/fpm/fpm/fpm_signals.h | 3 -- + sapi/fpm/fpm/fpm_unix.c | 81 +++++++++++++++++++++++++------------------ + 7 files changed, 63 insertions(+), 57 deletions(-) + +diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c +index dab415d..2f42175 100644 +--- a/sapi/fpm/fpm/fpm.c ++++ b/sapi/fpm/fpm/fpm.c +@@ -39,7 +39,7 @@ 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) /* {{{ */ +diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h +index 7a2903d..c576876 100644 +--- a/sapi/fpm/fpm/fpm.h ++++ b/sapi/fpm/fpm/fpm.h +@@ -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_main.c b/sapi/fpm/fpm/fpm_main.c +index cdec235..925cbc1 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -1799,16 +1799,20 @@ 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 (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 656269f..8993a86 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 13484cb..eb80fae 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_unix.c b/sapi/fpm/fpm/fpm_unix.c +index 5c5e37c..1a75944 100644 +--- a/sapi/fpm/fpm/fpm_unix.c ++++ b/sapi/fpm/fpm/fpm_unix.c +@@ -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); + } + } +-- +1.7.8 + diff --git a/php-5.4.7-imap.patch b/php-5.4.7-imap.patch new file mode 100644 index 0000000..d37d05c --- /dev/null +++ b/php-5.4.7-imap.patch @@ -0,0 +1,11 @@ +--- php-5.4.7/ext/imap/php_imap.c.orig 2012-09-22 09:00:39.661043173 +0200 ++++ php-5.4.7/ext/imap/php_imap.c 2012-09-22 09:01:13.606053829 +0200 +@@ -1191,7 +1191,7 @@ + if (zend_hash_index_find(Z_ARRVAL_PP(disabled_auth_method), i, (void **) &z_auth_method) == SUCCESS) { + if (Z_TYPE_PP(z_auth_method) == IS_STRING) { + if (Z_STRLEN_PP(z_auth_method) > 1) { +- mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(disabled_auth_method)); ++ mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(z_auth_method)); + } + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); diff --git a/php-5.4.7-odbctimer.patch b/php-5.4.7-odbctimer.patch new file mode 100644 index 0000000..88c4da4 --- /dev/null +++ b/php-5.4.7-odbctimer.patch @@ -0,0 +1,58 @@ +From 657494235eafe048e9fa6a19dcdb3c73a0cbe6ec Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 27 Sep 2012 13:45:32 +0200 +Subject: [PATCH] Fixed bug #63171, script hangs if odbc call during timeout + +--- + ext/odbc/php_odbc.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c +index 52d46b2..2169e65 100644 +--- a/ext/odbc/php_odbc.c ++++ b/ext/odbc/php_odbc.c +@@ -431,7 +431,8 @@ static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) + efree(res->values); + res->values = NULL; + } +- if (res->stmt) { ++ /* If aborted via timer expiration, don't try to call any unixODBC function */ ++ if (res->stmt && !(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { + #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) + SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, + (SQLUSMALLINT) SQL_COMMIT); +@@ -484,9 +485,12 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC) + } + } + +- safe_odbc_disconnect(conn->hdbc); +- SQLFreeConnect(conn->hdbc); +- SQLFreeEnv(conn->henv); ++ /* If aborted via timer expiration, don't try to call any unixODBC function */ ++ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { ++ safe_odbc_disconnect(conn->hdbc); ++ SQLFreeConnect(conn->hdbc); ++ SQLFreeEnv(conn->henv); ++ } + efree(conn); + ODBCG(num_links)--; + } +@@ -512,9 +516,12 @@ static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc TSRMLS_DC) + } + } + +- safe_odbc_disconnect(conn->hdbc); +- SQLFreeConnect(conn->hdbc); +- SQLFreeEnv(conn->henv); ++ /* If aborted via timer expiration, don't try to call any unixODBC function */ ++ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { ++ safe_odbc_disconnect(conn->hdbc); ++ SQLFreeConnect(conn->hdbc); ++ SQLFreeEnv(conn->henv); ++ } + free(conn); + + ODBCG(num_links)--; +-- +1.7.10 + diff --git a/php-5.4.7-sqlite.patch b/php-5.4.7-sqlite.patch new file mode 100644 index 0000000..2c26b86 --- /dev/null +++ b/php-5.4.7-sqlite.patch @@ -0,0 +1,27 @@ +From 05b9b50f09e10038230e1edab43b86afb67c14a8 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 24 Sep 2012 13:53:59 +0200 +Subject: [PATCH] Fix Bug #63149, check sqlite3_column_table_name availability + with system SQLite + +--- + ext/sqlite3/config0.m4 | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 +index ac58b35..1365def 100644 +--- a/ext/sqlite3/config0.m4 ++++ b/ext/sqlite3/config0.m4 +@@ -50,6 +50,9 @@ if test $PHP_SQLITE3 != "no"; then + PHP_CHECK_LIBRARY(sqlite3,sqlite3_key,[ + AC_DEFINE(HAVE_SQLITE3_KEY, 1, [have commercial sqlite3 with crypto support]) + ]) ++ PHP_CHECK_LIBRARY(sqlite3,sqlite3_column_table_name,[ ++ AC_DEFINE(SQLITE_ENABLE_COLUMN_METADATA, 1, [have sqlite3 with column metadata enabled]) ++ ]) + + PHP_CHECK_LIBRARY(sqlite3,sqlite3_load_extension, + [], +-- +1.7.10 + diff --git a/php-fpm.service b/php-fpm.service index 194e330..d90ed8c 100644 --- a/php-fpm.service +++ b/php-fpm.service @@ -7,6 +7,7 @@ PIDFile=/run/php-fpm/php-fpm.pid EnvironmentFile=/etc/sysconfig/php-fpm ExecStart=/usr/sbin/php-fpm --nodaemonize ExecReload=/bin/kill -USR2 $MAINPID +PrivateTmp=true [Install] WantedBy=multi-user.target diff --git a/php54.spec b/php54.spec index 82e8d83..0440157 100644 --- a/php54.spec +++ b/php54.spec @@ -65,7 +65,7 @@ Version: 5.4.7 %if 0%{?snapdate:1}%{?rcver:1} Release: 0.2.%{?snapdate}%{?rcver}%{?dist} %else -Release: 6%{?dist} +Release: 10%{?dist} %endif License: PHP Group: Development/Languages @@ -94,6 +94,14 @@ Patch7: php-5.3.0-recode.patch Patch8: php-5.4.7-libdb.patch # Fixes for extension modules +# https://bugs.php.net/63126 - DISABLE_AUTHENTICATOR ignores array +Patch20: php-5.4.7-imap.patch +# https://bugs.php.net/63171 no odbc call during timeout +Patch21: php-5.4.7-odbctimer.patch +# https://bugs.php.net/63149 check sqlite3_column_table_name +Patch22: php-5.4.7-sqlite.patch +# https://bugs.php.net/bug.php?id=62886 - php-fpm startup +Patch23: php-5.4.7-fpm.patch # Functional changes Patch40: php-5.4.0-dlopen.patch @@ -103,9 +111,8 @@ Patch42: php-5.3.1-systzdata-v9.patch Patch43: php-5.4.0-phpize.patch # Use system libzip instead of bundled one Patch44: php-5.4.5-system-libzip.patch -# improves php-fpm daemonize mode -# see https://bugs.php.net/63085 -Patch45: php-5.4.7-63085.patch +# https://bugs.php.net/63085 systemd integration +Patch45: php-5.4.7-fpm-systemd.patch # Fixes for tests @@ -678,6 +685,11 @@ httpd -V | grep -q 'threaded:.*yes' && exit 1 %patch7 -p1 -b .recode %patch8 -p1 -b .libdb +%patch20 -p1 -b .imap +%patch21 -p1 -b .odbctimer +%patch22 -p1 -b .tablename +%patch23 -p1 -b .fpmstartup + %patch40 -p1 -b .dlopen %patch41 -p1 -b .easter %if 0%{?fedora} >= 16 || 0%{?rhel} >= 5 @@ -687,7 +699,7 @@ httpd -V | grep -q 'threaded:.*yes' && exit 1 %if %{with_libzip} %patch44 -p1 -b .systzip %endif -%patch45 -p0 -b .63085 +%patch45 -p1 -b .systemd %patch91 -p1 -b .remi-oci8 @@ -704,15 +716,20 @@ mkdir build-cgi build-apache build-embedded build-zts build-ztscli \ build-fpm %endif -# Remove bogus test; position of read position after fopen(, "a+") -# is not defined by C standard, so don't presume anything. -rm -f ext/standard/tests/file/bug21131.phpt +# ----- Manage known as failed test ------- # php_egg_logo_guid() removed by patch41 rm -f tests/basic/php_egg_logo_guid.phpt - -# Tests that fail. -rm -f ext/standard/tests/file/bug22414.phpt \ - ext/iconv/tests/bug16069.phpt +# affected by systzdata patch +rm -f ext/date/tests/timezone_location_get.phpt +# https://bugs.php.net/63147 tests requiring an internet connection +rm -f ext/standard/tests/network/gethostbyname_basic002.phpt +rm -f ext/standard/tests/network/gethostbyname_error004.phpt +rm -f ext/standard/tests/network/getmxrr.phpt +# https://bugzilla.redhat.com/859878 - missing feature in SQLite +# https://bugs.php.net/63149 - build against system SQLite +rm -f ext/pdo_sqlite/tests/bug_42589.phpt +# fails sometime +rm -f ext/sockets/tests/mcast_ipv?_recv.phpt # Safety check for API version change. pver=$(sed -n '/#define PHP_VERSION /{s/.* "//;s/".*$//;p}' main/php_version.h) @@ -952,7 +969,7 @@ build --with-apxs2=%{_httpd_apxs} \ --with-mysql=shared,%{_prefix} \ --with-mysqli=shared,%{mysql_config} \ --with-pdo-mysql=shared,%{mysql_config} \ - --with-pdo-sqlite=shared,%{_prefix} \ + --without-pdo-sqlite \ ${without_shared} popd @@ -1060,7 +1077,7 @@ build --with-apxs2=%{_httpd_apxs} \ --with-mysql=shared,%{_prefix} \ --with-mysqli=shared,%{mysql_config} \ --with-pdo-mysql=shared,%{mysql_config} \ - --with-pdo-sqlite=shared,%{_prefix} \ + --without-pdo-sqlite \ ${without_shared} popd @@ -1188,6 +1205,10 @@ install -m 644 php-fpm.tmpfiles $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/php-fpm # install systemd unit files and scripts for handling server startup install -m 755 -d $RPM_BUILD_ROOT%{_unitdir} install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/ +%if 0%{?fedora} < 16 && 0%{?rhel} < 7 +# PrivateTmp only work on fedora >= 16 +sed -i -e '/PrivateTmp/s/true/false/' ${RPM_BUILD_ROOT}%{_unitdir}/php-fpm.service +%endif %else install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/run/php-fpm sed -i -e 's:/run:/var/run:' $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.conf @@ -1308,6 +1329,9 @@ echo -e "You should consider upgrading to a supported release.\n" %if %{with_fpm} %post fpm +%if 0%{?systemd_post:1} +%systemd_post php-fpm.service +%else if [ $1 = 1 ]; then # Initial installation %if 0%{?fedora} >= 15 @@ -1316,8 +1340,12 @@ if [ $1 = 1 ]; then /sbin/chkconfig --add php-fpm %endif fi +%endif %preun fpm +%if 0%{?systemd_preun:1} +%systemd_preun php-fpm.service +%else if [ $1 = 0 ]; then # Package removal, not upgrade %if 0%{?fedora} >= 15 @@ -1328,8 +1356,12 @@ if [ $1 = 0 ]; then /sbin/chkconfig --del php-fpm %endif fi +%endif %postun fpm +%if 0%{?systemd_postun_with_restart:1} +%systemd_postun_with_restart php-fpm.service +%else %if 0%{?fedora} >= 15 /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ]; then @@ -1341,6 +1373,7 @@ if [ $1 -ge 1 ]; then /sbin/service php-fpm condrestart >/dev/null 2>&1 || : fi %endif +%endif # Handle upgrading from SysV initscript to native systemd unit. # We can tell if a SysV version of php-fpm was previously installed by @@ -1477,6 +1510,25 @@ fi %changelog +* Mon Oct 1 2012 Remi Collet 5.4.7-10 +- fix typo in systemd macro + +* Mon Oct 1 2012 Remi Collet 5.4.7-9 +- php-fpm: enable PrivateTmp +- php-fpm: new systemd macros (#850268) +- php-fpm: add upstream patch for startup issue (#846858) + +* Fri Sep 28 2012 Remi Collet 5.4.7-8 +- systemd integration, https://bugs.php.net/63085 +- no odbc call during timeout, https://bugs.php.net/63171 +- check sqlite3_column_table_name, https://bugs.php.net/63149 + +* Mon Sep 24 2012 Remi Collet 5.4.7-7 +- most failed tests explained (i386, x86_64) + +* Wed Sep 19 2012 Remi Collet 5.4.7-6 +- fix for http://bugs.php.net/63126 (#783967) + * Wed Sep 19 2012 Remi Collet 5.4.7-6 - add --daemonize / --nodaemonize options to php-fpm upstream RFE: https://bugs.php.net/63085 -- cgit