Re: [PHP-CVS] com php-src: - add missing php-fpm.service.in: sapi/fpm/php-fpm.service.in
2012/10/23 Laruence larue...@php.net Hey, hello seems this file is missed in trunk. should this also merge into trunk? yes it should. My mistake now I got a configure error: config.status: error: cannot find input file: sapi/fpm/php-fpm.service.in thanks On Fri, Sep 28, 2012 at 6:47 AM, Jérôme Loyet f...@php.net wrote: Commit:2259a8f18b1f25c175c486f54849fcd9e61ecde1 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 00:47:56 +0200 Parents: 851a04bb7b680954249e825ea3fef420f7d66bb7 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2259a8f18b1f25c175c486f54849fcd9e61ecde1 Log: - add missing php-fpm.service.in Changed paths: A sapi/fpm/php-fpm.service.in Diff: diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in new file mode 100644 index 000..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 + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] com php-src: - Fixed bug #62887 (Only /status?plainfull gives last request cpu): sapi/fpm/fpm/fpm_status.c
laurence: I know, sorry, but merging never works gently. Each time, I'm in a situation from which I can never exit cleanly. I spend more time dealing with git than working on the patch ... you can easly understand I'm not continuing this way :( for me, it's a pain in the ass since php sources have been migrated to git. if you have a clean and simple solution: I'm all ears :) ++ fat 2012/9/28 Laruence larue...@php.net fat: you don't need to push to three branches individually, you should push to the 5.3, then merge them to 5.4 otherwise, we will got unmerged branches: https://github.com/php/php-src/network :) thanks On Fri, Sep 28, 2012 at 7:26 AM, Jérôme Loyet f...@php.net wrote: Commit:68eb608f3c639b2f03304e5794cd99f1074b67c0 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:26:20 +0200 Parents: 9ed421e3d7333bf68c0252000b98400cc6bc0cbf Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=68eb608f3c639b2f03304e5794cd99f1074b67c0 Log: - Fixed bug #62887 (Only /status?plainfull gives last request cpu) Bugs: https://bugs.php.net/62887 Changed paths: M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index b9b9a8c..2363b57 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) /* {{{ */ trthstart time/thtd%s/td/tr\n trthstart since/thtd%lu/td/tr\n trthaccepted conn/thtd%lu/td/tr\n -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ trthlisten queue/thtd%u/td/tr\n trthmax listen queue/thtd%u/td/tr\n trthlisten queue len/thtd%d/td/tr\n @@ -178,7 +178,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ thcontent length/th thuser/th thscript/th -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ thlast request cpu/th #endif thlast 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
Re: [PHP-CVS] com php-src: Merge branch 'fuckgit' into PHP-5.4: sapi/fpm/config.m4
2012/9/28 Pierre Joye pierre@gmail.com hi Jérôme, hi pierre, Could you please keep msg log sane? Yes, my mistake Thanks, On Fri, Sep 28, 2012 at 1:19 AM, Jérôme Loyet f...@php.net wrote: Commit:be043ab6d00e9747727aefcb0dde12a40ddb4e8d Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:19:01 +0200 Parents: b2f4e686f0947217ee70953ecbafa84f173770c2 72f3457161aaf8c6bd0980aff855beca20d63404 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be043ab6d00e9747727aefcb0dde12a40ddb4e8d Log: Merge branch 'fuckgit' into PHP-5.4 * fuckgit: - Fixed bug #62947 (Unneccesary warnings on FPM) - Fixed bug #63085 (Systemd integration and daemonize) Conflicts: sapi/fpm/config.m4 Bugs: https://bugs.php.net/62947 https://bugs.php.net/63085 Changed paths: MM sapi/fpm/config.m4 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Add missing NEWS entry: NEWS
Commit:34c3985979cb27cd1fff1ca767b3162357da7b0b Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 11:22:16 +0200 Parents: b530f53c67da40dfa132d9cf68449ccc6d34daf7 Branches: PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=34c3985979cb27cd1fff1ca767b3162357da7b0b Log: Add missing NEWS entry Changed paths: M NEWS Diff: diff --git a/NEWS b/NEWS index d93d958..ca00e47 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,7 @@ PHP NEWS . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) . Fixed bug #62947 (Unneccesary warnings on FPM). (fat) . Fixed bug #62887 (Only /status?plainfull gives last request cpu). (fat) + . Fixed bug #62216 (Add PID to php-fpm init.d script). (fat) - OpenSSL: . Implemented FR #61421 (OpenSSL signature verification missing RMD160, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #62216: NEWS sapi/fpm/init.d.php-fpm.in
Commit:bb02fd5772070f00a7d26f2a64f34b55f6eea326 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 11:18:08 +0200 Parents: 151b16cf7ff6ddbf2e11932949aaa2ecb0f22724 Branches: PHP-5.3 PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bb02fd5772070f00a7d26f2a64f34b55f6eea326 Log: Fixed bug #62216 Add PID to php-fpm init.d script Bugs: https://bugs.php.net/62216 Changed paths: M NEWS M sapi/fpm/init.d.php-fpm.in Diff: diff --git a/NEWS b/NEWS index 14e81ca..83abf01 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ PHP NEWS . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) . Fixed bug #62947 (Unneccesary warnings on FPM). (fat) . Fixed bug #62887 (Only /status?plainfull gives last request cpu). (fat) + . Fixed bug #62216 (Add PID to php-fpm init.d script). (fat) - Intl: . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) diff --git a/sapi/fpm/init.d.php-fpm.in b/sapi/fpm/init.d.php-fpm.in index 3edd64f..49cce79 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 () { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62954 (startup problems fpm / php-fpm) - Fixed bug #62886 (PHP-FPM may segfault/hang on startup): NEWS sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_main.c
Commit:b5eb1456aa17e83b7b734dfc2316d632c9adcc6c Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 00:05:48 +0200 Parents: 0bffdd723fb1acbc8b1ef62768fa2f33c2d02bbc Branches: PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b5eb1456aa17e83b7b734dfc2316d632c9adcc6c Log: - Fixed bug #62954 (startup problems fpm / php-fpm) - Fixed bug #62886 (PHP-FPM may segfault/hang on startup) Bugs: https://bugs.php.net/62954 https://bugs.php.net/62886 Changed paths: M NEWS M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_signals.c M sapi/fpm/fpm/fpm_signals.h M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/NEWS b/NEWS index 3a5cf66..cb534a4 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,10 @@ PHP NEWS - DOM: . Fixed bug #63015 (Incorrect arginfo for DOMErrorHandler). (Rob) +- FPM: + . Fixed bug #62954 (startup problems fpm / php-fpm). (fat) + . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) + - OpenSSL: . Implemented FR #61421 (OpenSSL signature verification missing RMD160, SHA224, SHA256, SHA384, SHA512). (Mark Jones) 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 -
[PHP-CVS] com php-src: - Fixed bug #62954 (startup problems fpm / php-fpm) - Fixed bug #62886 (PHP-FPM may segfault/hang on startup): NEWS sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_main.c
Commit:75c63c5503b1c6b72e5e1daf5b4bfd02c68a4b79 Author:Jerome Loyet f...@php.net Thu, 27 Sep 2012 23:54:35 +0200 Parents: a9db9efa0c98c5fa344432fc7b939e895296256e Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=75c63c5503b1c6b72e5e1daf5b4bfd02c68a4b79 Log: - Fixed bug #62954 (startup problems fpm / php-fpm) - Fixed bug #62886 (PHP-FPM may segfault/hang on startup) Bugs: https://bugs.php.net/62954 https://bugs.php.net/62886 Changed paths: M NEWS M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_signals.c M sapi/fpm/fpm/fpm_signals.h M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/NEWS b/NEWS index 191264b..354353f 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,10 @@ PHP NEWS . Fixed bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function). (Dmitry) +- FPM: + . Fixed bug #62954 (startup problems fpm / php-fpm). (fat) + . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) + - Intl: . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) 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 b058d7a..70e917a 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1804,16 +1804,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 -*
[PHP-CVS] com php-src: - fix merge (fucking git merging system ... :( ): sapi/fpm/config.m4
Commit:c8b7ea0f57819e675fa2e8c1dfebabb8b3f62ca6 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 00:55:06 +0200 Parents: 9e4c0b8142af8d2ca4999277a741534f020a488d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c8b7ea0f57819e675fa2e8c1dfebabb8b3f62ca6 Log: - fix merge (fucking git merging system ... :( ) Changed paths: M sapi/fpm/config.m4 diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index e69de29..3a2690e 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -0,0 +1,653 @@ +dnl +dnl $Id$ +dnl + +PHP_ARG_ENABLE(fpm,, +[ --enable-fpm Enable building of the fpm SAPI executable], no, no) + +dnl configure checks {{{ +AC_DEFUN([AC_FPM_STDLIBS], +[ + AC_CHECK_FUNCS(setenv clearenv setproctitle) + + AC_SEARCH_LIBS(socket, socket) + AC_SEARCH_LIBS(inet_addr, nsl) + + AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) + AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h]) + AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) + AC_CHECK_HEADERS([sysexits.h]) +]) + +AC_DEFUN([AC_FPM_PRCTL], +[ + AC_MSG_CHECKING([for prctl]) + + AC_TRY_COMPILE([ #include sys/prctl.h ], [prctl(0, 0, 0, 0, 0);], [ +AC_DEFINE([HAVE_PRCTL], 1, [do we have prctl?]) +AC_MSG_RESULT([yes]) + ], [ +AC_MSG_RESULT([no]) + ]) +]) + +AC_DEFUN([AC_FPM_CLOCK], +[ + have_clock_gettime=no + + AC_MSG_CHECKING([for clock_gettime]) + + AC_TRY_LINK([ #include time.h ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, ts);], [ +have_clock_gettime=yes +AC_MSG_RESULT([yes]) + ], [ +AC_MSG_RESULT([no]) + ]) + + if test $have_clock_gettime = no; then +AC_MSG_CHECKING([for clock_gettime in -lrt]) + +SAVED_LIBS=$LIBS +LIBS=$LIBS -lrt + +AC_TRY_LINK([ #include time.h ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, ts);], [ + have_clock_gettime=yes + AC_MSG_RESULT([yes]) +], [ + LIBS=$SAVED_LIBS + AC_MSG_RESULT([no]) +]) + fi + + if test $have_clock_gettime = yes; then +AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [do we have clock_gettime?]) + fi + + have_clock_get_time=no + + if test $have_clock_gettime = no; then +AC_MSG_CHECKING([for clock_get_time]) + +AC_TRY_RUN([ #include mach/mach.h + #include mach/clock.h + #include mach/mach_error.h + + int main() + { +kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime; +ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, aClock); + +if (ret != KERN_SUCCESS) { + return 1; +} + +ret = clock_get_time(aClock, aTime); +if (ret != KERN_SUCCESS) { + return 2; +} + +return 0; + } +], [ + have_clock_get_time=yes + AC_MSG_RESULT([yes]) +], [ + AC_MSG_RESULT([no]) +]) + fi + + if test $have_clock_get_time = yes; then +AC_DEFINE([HAVE_CLOCK_GET_TIME], 1, [do we have clock_get_time?]) + fi +]) + +AC_DEFUN([AC_FPM_TRACE], +[ + have_ptrace=no + have_broken_ptrace=no + + AC_MSG_CHECKING([for ptrace]) + + AC_TRY_COMPILE([ +#include sys/types.h +#include sys/ptrace.h ], [ptrace(0, 0, (void *) 0, 0);], [ +have_ptrace=yes +AC_MSG_RESULT([yes]) + ], [ +AC_MSG_RESULT([no]) + ]) + + if test $have_ptrace = yes; then +AC_MSG_CHECKING([whether ptrace works]) + +AC_TRY_RUN([ + #include unistd.h + #include signal.h + #include sys/wait.h + #include sys/types.h + #include sys/ptrace.h + #include errno.h + + #if !defined(PTRACE_ATTACH) defined(PT_ATTACH) + #define PTRACE_ATTACH PT_ATTACH + #endif + + #if !defined(PTRACE_DETACH) defined(PT_DETACH) + #define PTRACE_DETACH PT_DETACH + #endif + + #if !defined(PTRACE_PEEKDATA) defined(PT_READ_D) + #define PTRACE_PEEKDATA PT_READ_D + #endif + + int main() + { +long v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got int ptrace() */ +long v2; +pid_t child; +int status; + +if ( (child = fork()) ) { /* parent */ + int ret = 0; + + if (0 ptrace(PTRACE_ATTACH, child, 0, 0)) { +return 2; + } + + waitpid(child, status, 0); + + #ifdef PT_IO + struct ptrace_io_desc ptio = { +.piod_op = PIOD_READ_D, +.piod_offs = v1, +.piod_addr = v2, +.piod_len = sizeof(v1) + }; + + if (0 ptrace(PT_IO, child, (void *) ptio, 0)) { +ret = 3; + } + #else + errno = 0; + + v2 = ptrace(PTRACE_PEEKDATA, child, (void *) v1, 0); + + if (errno) { +ret = 4; + } + #endif + ptrace(PTRACE_DETACH, child, (void *) 1, 0); + + kill(child, SIGKILL); + + return ret ? ret : (v1 != v2); +} +else { /* child */ + sleep(10); + return 0; +
[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: sapi/fpm/config.m4 sapi/fpm/fpm/fpm_main.c
Commit:b2f4e686f0947217ee70953ecbafa84f173770c2 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 00:39:29 +0200 Parents: b5eb1456aa17e83b7b734dfc2316d632c9adcc6c 851a04bb7b680954249e825ea3fef420f7d66bb7 Branches: PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b2f4e686f0947217ee70953ecbafa84f173770c2 Log: Merge branch 'PHP-5.3' into PHP-5.4 * PHP-5.3: - Fixed bug #63085 (Systemd integration and daemonize) - Fixed bug #62954 (startup problems fpm / php-fpm) - Fixed bug #62886 (PHP-FPM may segfault/hang on startup) Conflicts: sapi/fpm/config.m4 Bugs: https://bugs.php.net/63085 https://bugs.php.net/62954 https://bugs.php.net/62886 Changed paths: MM sapi/fpm/config.m4 MM sapi/fpm/fpm/fpm_main.c diff --cc sapi/fpm/config.m4 index ad46717,7687660..e69de29 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@@ -1,653 -1,647 +1,0 @@@ --dnl --dnl $Id$ --dnl -- --PHP_ARG_ENABLE(fpm,, - [ --enable-fpm Enable building of the fpm SAPI executable], no, no) - - dnl configure checks {{{ - AC_DEFUN([AC_FPM_STDLIBS], - [ - AC_CHECK_FUNCS(setenv clearenv setproctitle) - - AC_SEARCH_LIBS(socket, socket) - AC_SEARCH_LIBS(inet_addr, nsl) - - AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) - AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h]) - AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) - AC_CHECK_HEADERS([sysexits.h]) - ]) - - AC_DEFUN([AC_FPM_PRCTL], - [ - AC_MSG_CHECKING([for prctl]) - - AC_TRY_COMPILE([ #include sys/prctl.h ], [prctl(0, 0, 0, 0, 0);], [ - AC_DEFINE([HAVE_PRCTL], 1, [do we have prctl?]) - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - ]) - - AC_DEFUN([AC_FPM_CLOCK], - [ - have_clock_gettime=no - - AC_MSG_CHECKING([for clock_gettime]) - - AC_TRY_LINK([ #include time.h ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, ts);], [ - have_clock_gettime=yes - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - if test $have_clock_gettime = no; then - AC_MSG_CHECKING([for clock_gettime in -lrt]) - - SAVED_LIBS=$LIBS - LIBS=$LIBS -lrt - - AC_TRY_LINK([ #include time.h ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, ts);], [ - have_clock_gettime=yes - AC_MSG_RESULT([yes]) - ], [ - LIBS=$SAVED_LIBS - AC_MSG_RESULT([no]) - ]) - fi - - if test $have_clock_gettime = yes; then - AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [do we have clock_gettime?]) - fi - - have_clock_get_time=no - - if test $have_clock_gettime = no; then - AC_MSG_CHECKING([for clock_get_time]) - - AC_TRY_RUN([ #include mach/mach.h - #include mach/clock.h - #include mach/mach_error.h - - int main() - { - kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime; - ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, aClock); - - if (ret != KERN_SUCCESS) { - return 1; - } - - ret = clock_get_time(aClock, aTime); - if (ret != KERN_SUCCESS) { - return 2; - } - - return 0; - } - ], [ - have_clock_get_time=yes - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - fi - - if test $have_clock_get_time = yes; then - AC_DEFINE([HAVE_CLOCK_GET_TIME], 1, [do we have clock_get_time?]) - fi - ]) - - AC_DEFUN([AC_FPM_TRACE], - [ - have_ptrace=no - have_broken_ptrace=no - - AC_MSG_CHECKING([for ptrace]) - - AC_TRY_COMPILE([ - #include sys/types.h - #include sys/ptrace.h ], [ptrace(0, 0, (void *) 0, 0);], [ - have_ptrace=yes - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - if test $have_ptrace = yes; then - AC_MSG_CHECKING([whether ptrace works]) - - AC_TRY_RUN([ - #include unistd.h - #include signal.h - #include sys/wait.h - #include sys/types.h - #include sys/ptrace.h - #include errno.h - - #if !defined(PTRACE_ATTACH) defined(PT_ATTACH) - #define PTRACE_ATTACH PT_ATTACH - #endif - - #if !defined(PTRACE_DETACH) defined(PT_DETACH) - #define PTRACE_DETACH PT_DETACH - #endif - - #if !defined(PTRACE_PEEKDATA) defined(PT_READ_D) - #define PTRACE_PEEKDATA PT_READ_D - #endif - - int main() - { - long v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got int ptrace() */ - long v2; - pid_t child; - int status; - - if ( (child = fork()) ) { /* parent */ - int ret = 0; - - if (0 ptrace(PTRACE_ATTACH, child, 0, 0)) { - return 2; - } - - waitpid(child, status, 0); - - #ifdef PT_IO - struct ptrace_io_desc ptio = { - .piod_op = PIOD_READ_D, - .piod_offs = v1, - .piod_addr = v2, -
[PHP-CVS] com php-src: - add missing php-fpm.service.in: sapi/fpm/php-fpm.service.in
Commit:2259a8f18b1f25c175c486f54849fcd9e61ecde1 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 00:47:56 +0200 Parents: 851a04bb7b680954249e825ea3fef420f7d66bb7 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2259a8f18b1f25c175c486f54849fcd9e61ecde1 Log: - add missing php-fpm.service.in Changed paths: A sapi/fpm/php-fpm.service.in Diff: diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in new file mode 100644 index 000..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 + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #63085 (Systemd integration and daemonize): NEWS sapi/fpm/config.m4 sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/fp
Commit:851a04bb7b680954249e825ea3fef420f7d66bb7 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 00:33:05 +0200 Parents: 75c63c5503b1c6b72e5e1daf5b4bfd02c68a4b79 Branches: PHP-5.3 PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=851a04bb7b680954249e825ea3fef420f7d66bb7 Log: - Fixed bug #63085 (Systemd integration and daemonize) Bugs: https://bugs.php.net/63085 Changed paths: M NEWS M sapi/fpm/config.m4 M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_conf.c M sapi/fpm/fpm/fpm_conf.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/init.d.php-fpm.in M sapi/fpm/php-fpm.8.in diff --git a/NEWS b/NEWS index 354353f..4e9f98d 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ PHP NEWS - FPM: . Fixed bug #62954 (startup problems fpm / php-fpm). (fat) . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) + . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) - Intl: . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) 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 @@ -583,7 +583,7 @@ 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]) - 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], [$abs_srcdir/sapi/fpm], [sapi/fpm]) 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
[PHP-CVS] com php-src: - Fixed bug #62947 (Unneccesary warnings on FPM): sapi/fpm/fpm/fpm_unix.c
Commit:9ed421e3d7333bf68c0252000b98400cc6bc0cbf Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:09:31 +0200 Parents: c8b7ea0f57819e675fa2e8c1dfebabb8b3f62ca6 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9ed421e3d7333bf68c0252000b98400cc6bc0cbf Log: - Fixed bug #62947 (Unneccesary warnings on FPM) Bugs: https://bugs.php.net/62947 Changed paths: M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 1a75944..48249e8 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 */ @@ -350,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); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62947 (Unneccesary warnings on FPM): NEWS sapi/fpm/fpm/fpm_unix.c
Commit:e31553c2042f2a5e05d9ad1ba77b888c63e4c36f Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:08:08 +0200 Parents: 2259a8f18b1f25c175c486f54849fcd9e61ecde1 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e31553c2042f2a5e05d9ad1ba77b888c63e4c36f Log: - Fixed bug #62947 (Unneccesary warnings on FPM) Bugs: https://bugs.php.net/62947 Changed paths: M NEWS M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/NEWS b/NEWS index 4e9f98d..69a6c7e 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ PHP NEWS . Fixed bug #62954 (startup problems fpm / php-fpm). (fat) . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) + . Fixed bug #62947 (Unneccesary warnings on FPM). (fat) - Intl: . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 1a75944..48249e8 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 */ @@ -350,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); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'fuckgit' into PHP-5.4: sapi/fpm/config.m4
Commit:be043ab6d00e9747727aefcb0dde12a40ddb4e8d Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:19:01 +0200 Parents: b2f4e686f0947217ee70953ecbafa84f173770c2 72f3457161aaf8c6bd0980aff855beca20d63404 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be043ab6d00e9747727aefcb0dde12a40ddb4e8d Log: Merge branch 'fuckgit' into PHP-5.4 * fuckgit: - Fixed bug #62947 (Unneccesary warnings on FPM) - Fixed bug #63085 (Systemd integration and daemonize) Conflicts: sapi/fpm/config.m4 Bugs: https://bugs.php.net/62947 https://bugs.php.net/63085 Changed paths: MM sapi/fpm/config.m4 diff --cc sapi/fpm/config.m4 index e69de29,3a2690e..6191c32 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@@ -1,0 -1,653 +1,657 @@@ + dnl + dnl $Id$ + dnl + + PHP_ARG_ENABLE(fpm,, + [ --enable-fpm Enable building of the fpm SAPI executable], no, no) + + dnl configure checks {{{ + AC_DEFUN([AC_FPM_STDLIBS], + [ + AC_CHECK_FUNCS(setenv clearenv setproctitle) + + AC_SEARCH_LIBS(socket, socket) + AC_SEARCH_LIBS(inet_addr, nsl) + + AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) + AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h]) + AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) + AC_CHECK_HEADERS([sysexits.h]) + ]) + + AC_DEFUN([AC_FPM_PRCTL], + [ + AC_MSG_CHECKING([for prctl]) + + AC_TRY_COMPILE([ #include sys/prctl.h ], [prctl(0, 0, 0, 0, 0);], [ + AC_DEFINE([HAVE_PRCTL], 1, [do we have prctl?]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + ]) + + AC_DEFUN([AC_FPM_CLOCK], + [ + have_clock_gettime=no + + AC_MSG_CHECKING([for clock_gettime]) + + AC_TRY_LINK([ #include time.h ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, ts);], [ + have_clock_gettime=yes + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + if test $have_clock_gettime = no; then + AC_MSG_CHECKING([for clock_gettime in -lrt]) + + SAVED_LIBS=$LIBS + LIBS=$LIBS -lrt + + AC_TRY_LINK([ #include time.h ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, ts);], [ + have_clock_gettime=yes + AC_MSG_RESULT([yes]) + ], [ + LIBS=$SAVED_LIBS + AC_MSG_RESULT([no]) + ]) + fi + + if test $have_clock_gettime = yes; then + AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [do we have clock_gettime?]) + fi + + have_clock_get_time=no + + if test $have_clock_gettime = no; then + AC_MSG_CHECKING([for clock_get_time]) + + AC_TRY_RUN([ #include mach/mach.h + #include mach/clock.h + #include mach/mach_error.h + + int main() + { + kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime; + ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, aClock); + + if (ret != KERN_SUCCESS) { + return 1; + } + + ret = clock_get_time(aClock, aTime); + if (ret != KERN_SUCCESS) { + return 2; + } + + return 0; + } + ], [ + have_clock_get_time=yes + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + fi + + if test $have_clock_get_time = yes; then + AC_DEFINE([HAVE_CLOCK_GET_TIME], 1, [do we have clock_get_time?]) + fi + ]) + + AC_DEFUN([AC_FPM_TRACE], + [ + have_ptrace=no + have_broken_ptrace=no + + AC_MSG_CHECKING([for ptrace]) + + AC_TRY_COMPILE([ + #include sys/types.h + #include sys/ptrace.h ], [ptrace(0, 0, (void *) 0, 0);], [ + have_ptrace=yes + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + if test $have_ptrace = yes; then + AC_MSG_CHECKING([whether ptrace works]) + + AC_TRY_RUN([ + #include unistd.h + #include signal.h + #include sys/wait.h + #include sys/types.h + #include sys/ptrace.h + #include errno.h + + #if !defined(PTRACE_ATTACH) defined(PT_ATTACH) + #define PTRACE_ATTACH PT_ATTACH + #endif + + #if !defined(PTRACE_DETACH) defined(PT_DETACH) + #define PTRACE_DETACH PT_DETACH + #endif + + #if !defined(PTRACE_PEEKDATA) defined(PT_READ_D) + #define PTRACE_PEEKDATA PT_READ_D + #endif + + int main() + { + long v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got int ptrace() */ + long v2; + pid_t child; + int status; + + if ( (child = fork()) ) { /* parent */ + int ret = 0; + + if (0 ptrace(PTRACE_ATTACH, child, 0, 0)) { + return 2; + } + + waitpid(child, status, 0); + + #ifdef PT_IO + struct ptrace_io_desc ptio = { + .piod_op = PIOD_READ_D, + .piod_offs = v1, + .piod_addr = v2, + .piod_len = sizeof(v1) + }; + + if (0 ptrace(PT_IO, child, (void *) ptio, 0)) { + ret = 3; +
[PHP-CVS] com php-src: - Fixed bug #62947 (Unneccesary warnings on FPM): NEWS sapi/fpm/fpm/fpm_unix.c
Commit:72f3457161aaf8c6bd0980aff855beca20d63404 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:08:48 +0200 Parents: 64a0e7cdc2a90a13dd238068a7ff3d357de284b4 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=72f3457161aaf8c6bd0980aff855beca20d63404 Log: - Fixed bug #62947 (Unneccesary warnings on FPM) Bugs: https://bugs.php.net/62947 Changed paths: M NEWS M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/NEWS b/NEWS index 65ccc9a..199a2fb 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ PHP NEWS . Fixed bug #62954 (startup problems fpm / php-fpm). (fat) . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) + . Fixed bug #62947 (Unneccesary warnings on FPM). (fat) - OpenSSL: . Implemented FR #61421 (OpenSSL signature verification missing RMD160, diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 1a75944..48249e8 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 */ @@ -350,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); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #63085 (Systemd integration and daemonize): NEWS sapi/fpm/config.m4 sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/fp
Commit:64a0e7cdc2a90a13dd238068a7ff3d357de284b4 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 00:53:05 +0200 Parents: b5eb1456aa17e83b7b734dfc2316d632c9adcc6c Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=64a0e7cdc2a90a13dd238068a7ff3d357de284b4 Log: - Fixed bug #63085 (Systemd integration and daemonize) Bugs: https://bugs.php.net/63085 Changed paths: M NEWS M sapi/fpm/config.m4 M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_conf.c M sapi/fpm/fpm/fpm_conf.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/init.d.php-fpm.in M sapi/fpm/php-fpm.8.in A sapi/fpm/php-fpm.service.in diff --git a/NEWS b/NEWS index cb534a4..65ccc9a 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ PHP NEWS - FPM: . Fixed bug #62954 (startup problems fpm / php-fpm). (fat) . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) + . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) - OpenSSL: . Implemented FR #61421 (OpenSSL signature verification missing RMD160, diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index ad46717..3a2690e 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -589,7 +589,7 @@ if test $PHP_FPM != no; then 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
[PHP-CVS] com php-src: - Fixed bug #62887 (Only /status?plainfull gives last request cpu): NEWS sapi/fpm/fpm/fpm_status.c
Commit:9ef925b3519e5b1a54b930035f347e4d0f61a210 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:25:51 +0200 Parents: be043ab6d00e9747727aefcb0dde12a40ddb4e8d Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9ef925b3519e5b1a54b930035f347e4d0f61a210 Log: - Fixed bug #62887 (Only /status?plainfull gives last request cpu) Bugs: https://bugs.php.net/62887 Changed paths: M NEWS M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/NEWS b/NEWS index 199a2fb..d93d958 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ PHP NEWS . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) . Fixed bug #62947 (Unneccesary warnings on FPM). (fat) + . Fixed bug #62887 (Only /status?plainfull gives last request cpu). (fat) - OpenSSL: . Implemented FR #61421 (OpenSSL signature verification missing RMD160, diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index b9b9a8c..2363b57 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) /* {{{ */ trthstart time/thtd%s/td/tr\n trthstart since/thtd%lu/td/tr\n trthaccepted conn/thtd%lu/td/tr\n -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ trthlisten queue/thtd%u/td/tr\n trthmax listen queue/thtd%u/td/tr\n trthlisten queue len/thtd%d/td/tr\n @@ -178,7 +178,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ thcontent length/th thuser/th thscript/th -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ thlast request cpu/th #endif thlast 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) /* {{{ */
[PHP-CVS] com php-src: - Fixed bug #62887 (Only /status?plainfull gives last request cpu): NEWS sapi/fpm/fpm/fpm_status.c
Commit:151b16cf7ff6ddbf2e11932949aaa2ecb0f22724 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:24:52 +0200 Parents: e31553c2042f2a5e05d9ad1ba77b888c63e4c36f Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=151b16cf7ff6ddbf2e11932949aaa2ecb0f22724 Log: - Fixed bug #62887 (Only /status?plainfull gives last request cpu) Bugs: https://bugs.php.net/62887 Changed paths: M NEWS M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/NEWS b/NEWS index 69a6c7e..14e81ca 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ PHP NEWS . Fixed bug #62886 (PHP-FPM may segfault/hang on startup). (fat) . Fixed bug #63085 (Systemd integration and daemonize). (remi, fat) . Fixed bug #62947 (Unneccesary warnings on FPM). (fat) + . Fixed bug #62887 (Only /status?plainfull gives last request cpu). (fat) - Intl: . Fix bug #62915 (defective cloning in several intl classes). (Gustavo) diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 3b09d3b..7bad595 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) /* {{{ */ trthstart time/thtd%s/td/tr\n trthstart since/thtd%lu/td/tr\n trthaccepted conn/thtd%lu/td/tr\n -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ trthlisten queue/thtd%u/td/tr\n trthmax listen queue/thtd%u/td/tr\n trthlisten queue len/thtd%d/td/tr\n @@ -177,7 +177,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ thcontent length/th thuser/th thscript/th -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ thlast request cpu/th #endif thlast request memory/th @@ -196,7 +196,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 @@ -219,7 +219,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 @@ -247,7 +247,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 @@ -268,7 +268,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, @@ -297,7 +297,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 @@ -317,7 +317,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 @@ -358,7 +358,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
[PHP-CVS] com php-src: - Fixed bug #62887 (Only /status?plainfull gives last request cpu): sapi/fpm/fpm/fpm_status.c
Commit:68eb608f3c639b2f03304e5794cd99f1074b67c0 Author:Jerome Loyet f...@php.net Fri, 28 Sep 2012 01:26:20 +0200 Parents: 9ed421e3d7333bf68c0252000b98400cc6bc0cbf Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=68eb608f3c639b2f03304e5794cd99f1074b67c0 Log: - Fixed bug #62887 (Only /status?plainfull gives last request cpu) Bugs: https://bugs.php.net/62887 Changed paths: M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index b9b9a8c..2363b57 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) /* {{{ */ trthstart time/thtd%s/td/tr\n trthstart since/thtd%lu/td/tr\n trthaccepted conn/thtd%lu/td/tr\n -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ trthlisten queue/thtd%u/td/tr\n trthmax listen queue/thtd%u/td/tr\n trthlisten queue len/thtd%d/td/tr\n @@ -178,7 +178,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ thcontent length/th thuser/th thscript/th -#if HAVE_FPM_LQ +#ifdef HAVE_FPM_LQ thlast request cpu/th #endif thlast 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, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - fix missing include for unix sockets: sapi/fpm/fpm/fpm_sockets.h
Commit:35abf3f20c36109b4afdcbd62db9a1846575ac3d Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:16:53 +0200 Parents: 59e0930d37e2a559317e2c08ecfee5a84bde925d Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=35abf3f20c36109b4afdcbd62db9a1846575ac3d Log: - fix missing include for unix sockets Changed paths: M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 5b9c698..499ba6b 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -7,6 +7,7 @@ #include sys/types.h #include sys/socket.h +#include sys/un.h #include unistd.h #include fcntl.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)): NEWS sapi/fpm/fpm/fpm_php.c sapi/fpm/fpm/fpm_php.h sapi/fpm/fpm/fpm_status.c
Commit:38ca8cb7a12548b44b942ddd4fb2628b70bc6612 Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:18:48 +0200 Parents: 35abf3f20c36109b4afdcbd62db9a1846575ac3d Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=38ca8cb7a12548b44b942ddd4fb2628b70bc6612 Log: - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)) Bugs: https://bugs.php.net/62205 Changed paths: M NEWS M sapi/fpm/fpm/fpm_php.c M sapi/fpm/fpm/fpm_php.h M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/NEWS b/NEWS index d031c3c..42eb5b4 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ PHP NEWS . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) . Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests). (fat) + . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 840eec7..cd4d3ae 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -257,3 +257,41 @@ int fpm_php_limit_extensions(char *path) /* {{{ */ return 1; /* extension not found: not allowed */ } /* }}} */ + +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC) /* {{{ */ +{ + zval **data, **tmp; + char *string_key; + uint string_len; + ulong num_key; + if (!table || !key) { + return NULL; + } + + /* inspired from ext/standard/info.c */ + + zend_is_auto_global(table, strlen(table) TSRMLS_CC); + + /* find the table and ensure it's an array */ + if (zend_hash_find(EG(symbol_table), table, strlen(table) + 1, (void **) data) == SUCCESS Z_TYPE_PP(data) == IS_ARRAY) { + + /* reset the internal pointer */ + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + + /* parse the array to look for our key */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) tmp) == SUCCESS) { + /* ensure the key is a string */ + if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), string_key, string_len, num_key, 0, NULL) == HASH_KEY_IS_STRING) { + /* compare to our key */ + if (!strncmp(string_key, key, string_len)) { + return Z_STRVAL_PP(tmp); + } + } + zend_hash_move_forward(Z_ARRVAL_PP(data)); + } + } + + return NULL; +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_php.h b/sapi/fpm/fpm/fpm_php.h index a2c7ed3..d605473 100644 --- a/sapi/fpm/fpm/fpm_php.h +++ b/sapi/fpm/fpm/fpm_php.h @@ -44,6 +44,7 @@ void fpm_php_soft_quit(); int fpm_php_init_main(); int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode); int fpm_php_limit_extensions(char *path); +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC); #endif diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index e64a645..3b09d3b 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -14,6 +14,7 @@ #include zlog.h #include fpm_atomic.h #include fpm_conf.h +#include fpm_php.h #include ext/standard/html.h static char *fpm_status_uri = NULL; @@ -125,13 +126,13 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* full status ? */ - full = SG(request_info).request_uri strstr(SG(request_info).query_string, full); + full = (fpm_php_get_string_from_table(_GET, full TSRMLS_CC) != NULL); short_syntax = short_post = NULL; full_separator = full_pre = full_syntax = full_post = NULL; encode = 0; /* HTML */ - if (SG(request_info).query_string strstr(SG(request_info).query_string, html)) { + if (fpm_php_get_string_from_table(_GET, html TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL(Content-Type: text/html), 1, 1 TSRMLS_CC); time_format = %d/%b/%Y:%H:%M:%S %z; encode = 1; @@ -205,7 +206,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* XML */ - } else if (SG(request_info).request_uri strstr(SG(request_info).query_string, xml)) { + } else if (fpm_php_get_string_from_table(_GET, xml TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL(Content-Type: text/xml), 1, 1 TSRMLS_CC); time_format = %s; encode = 1; @@ -256,7 +257,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* JSON */ -
[PHP-CVS] com php-src: - Comment unused function to avoid warnings: sapi/fpm/fpm/fpm_conf.c
Commit:59e0930d37e2a559317e2c08ecfee5a84bde925d Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:16:00 +0200 Parents: 1f5327a6022fedc1985d2daa6d189313d808b08b Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=59e0930d37e2a559317e2c08ecfee5a84bde925d Log: - Comment unused function to avoid warnings Changed paths: M sapi/fpm/fpm/fpm_conf.c Diff: diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 1f3258f..dfe6792 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -53,7 +53,9 @@ static int fpm_conf_load_ini_file(char *filename TSRMLS_DC); static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset); +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset); +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_boolean(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset); @@ -242,6 +244,7 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) / } /* }}} */ +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* {{{ */ { char *val = Z_STRVAL_P(value); @@ -257,6 +260,7 @@ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* { return NULL; } /* }}} */ +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset) /* {{{ */ { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)): NEWS sapi/fpm/fpm/fpm_php.c sapi/fpm/fpm/fpm_php.h sapi/fpm/fpm/fpm_status.c
Commit:238caeb63c4f4faf67b9f8de62a753eb3e954dbe Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:23:01 +0200 Parents: ec4a1d576b07f05e65a649842ed701def21adadd Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=238caeb63c4f4faf67b9f8de62a753eb3e954dbe Log: - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)) Bugs: https://bugs.php.net/62205 Changed paths: M NEWS M sapi/fpm/fpm/fpm_php.c M sapi/fpm/fpm/fpm_php.h M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/NEWS b/NEWS index eed55f1..363a8b7 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,7 @@ PHP NEWS . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) . Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests). (fat) + . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - Intl . ResourceBundle constructor now accepts NULL for the first two arguments. diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 840eec7..cd4d3ae 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -257,3 +257,41 @@ int fpm_php_limit_extensions(char *path) /* {{{ */ return 1; /* extension not found: not allowed */ } /* }}} */ + +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC) /* {{{ */ +{ + zval **data, **tmp; + char *string_key; + uint string_len; + ulong num_key; + if (!table || !key) { + return NULL; + } + + /* inspired from ext/standard/info.c */ + + zend_is_auto_global(table, strlen(table) TSRMLS_CC); + + /* find the table and ensure it's an array */ + if (zend_hash_find(EG(symbol_table), table, strlen(table) + 1, (void **) data) == SUCCESS Z_TYPE_PP(data) == IS_ARRAY) { + + /* reset the internal pointer */ + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + + /* parse the array to look for our key */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) tmp) == SUCCESS) { + /* ensure the key is a string */ + if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), string_key, string_len, num_key, 0, NULL) == HASH_KEY_IS_STRING) { + /* compare to our key */ + if (!strncmp(string_key, key, string_len)) { + return Z_STRVAL_PP(tmp); + } + } + zend_hash_move_forward(Z_ARRVAL_PP(data)); + } + } + + return NULL; +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_php.h b/sapi/fpm/fpm/fpm_php.h index a2c7ed3..d605473 100644 --- a/sapi/fpm/fpm/fpm_php.h +++ b/sapi/fpm/fpm/fpm_php.h @@ -44,6 +44,7 @@ void fpm_php_soft_quit(); int fpm_php_init_main(); int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode); int fpm_php_limit_extensions(char *path); +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC); #endif diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 83de76d..5f2c852 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -14,6 +14,7 @@ #include zlog.h #include fpm_atomic.h #include fpm_conf.h +#include fpm_php.h #include ext/standard/html.h static char *fpm_status_uri = NULL; @@ -125,13 +126,13 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* full status ? */ - full = SG(request_info).request_uri strstr(SG(request_info).query_string, full); + full = (fpm_php_get_string_from_table(_GET, full TSRMLS_CC) != NULL); short_syntax = short_post = NULL; full_separator = full_pre = full_syntax = full_post = NULL; encode = 0; /* HTML */ - if (SG(request_info).query_string strstr(SG(request_info).query_string, html)) { + if (fpm_php_get_string_from_table(_GET, html TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL(Content-Type: text/html), 1, 1 TSRMLS_CC); time_format = %d/%b/%Y:%H:%M:%S %z; encode = 1; @@ -205,7 +206,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* XML */ - } else if (SG(request_info).request_uri strstr(SG(request_info).query_string, xml)) { + } else if (fpm_php_get_string_from_table(_GET, xml TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL(Content-Type: text/xml), 1, 1 TSRMLS_CC); time_format = %s; encode = 1; @@ -256,7 +257,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /*
[PHP-CVS] com php-src: - fix missing include for unix sockets: sapi/fpm/fpm/fpm_sockets.h
Commit:ec4a1d576b07f05e65a649842ed701def21adadd Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:22:18 +0200 Parents: 43ec7088829338decce93ea4aada34f0bb6f069b Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec4a1d576b07f05e65a649842ed701def21adadd Log: - fix missing include for unix sockets Changed paths: M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 5b9c698..499ba6b 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -7,6 +7,7 @@ #include sys/types.h #include sys/socket.h +#include sys/un.h #include unistd.h #include fcntl.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Comment unused function to avoid warnings: sapi/fpm/fpm/fpm_conf.c
Commit:43ec7088829338decce93ea4aada34f0bb6f069b Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:22:02 +0200 Parents: 773e85a788de7dc557201d4af2cb10250c049052 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=43ec7088829338decce93ea4aada34f0bb6f069b Log: - Comment unused function to avoid warnings Changed paths: M sapi/fpm/fpm/fpm_conf.c Diff: diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 1f3258f..dfe6792 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -53,7 +53,9 @@ static int fpm_conf_load_ini_file(char *filename TSRMLS_DC); static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset); +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset); +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_boolean(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset); @@ -242,6 +244,7 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) / } /* }}} */ +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* {{{ */ { char *val = Z_STRVAL_P(value); @@ -257,6 +260,7 @@ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* { return NULL; } /* }}} */ +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset) /* {{{ */ { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - fix missing include for unix sockets: sapi/fpm/fpm/fpm_sockets.h
Commit:487e2fc0d50aca979864b59ff01450cf5e381874 Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:26:55 +0200 Parents: 34b6a9b32cb1271441a8fa9f39f13d33f3a3e9ec Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=487e2fc0d50aca979864b59ff01450cf5e381874 Log: - fix missing include for unix sockets Changed paths: M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 5b9c698..499ba6b 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -7,6 +7,7 @@ #include sys/types.h #include sys/socket.h +#include sys/un.h #include unistd.h #include fcntl.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)): sapi/fpm/fpm/fpm_php.c sapi/fpm/fpm/fpm_php.h sapi/fpm/fpm/fpm_status.c
Commit:4fc989fbbd0405d200872219b409f685a495f3aa Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:27:19 +0200 Parents: 487e2fc0d50aca979864b59ff01450cf5e381874 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4fc989fbbd0405d200872219b409f685a495f3aa Log: - Fixed bug #62205 (php-fpm segfaults (null passed to strstr)) Bugs: https://bugs.php.net/62205 Changed paths: M sapi/fpm/fpm/fpm_php.c M sapi/fpm/fpm/fpm_php.h M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 840eec7..cd4d3ae 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -257,3 +257,41 @@ int fpm_php_limit_extensions(char *path) /* {{{ */ return 1; /* extension not found: not allowed */ } /* }}} */ + +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC) /* {{{ */ +{ + zval **data, **tmp; + char *string_key; + uint string_len; + ulong num_key; + if (!table || !key) { + return NULL; + } + + /* inspired from ext/standard/info.c */ + + zend_is_auto_global(table, strlen(table) TSRMLS_CC); + + /* find the table and ensure it's an array */ + if (zend_hash_find(EG(symbol_table), table, strlen(table) + 1, (void **) data) == SUCCESS Z_TYPE_PP(data) == IS_ARRAY) { + + /* reset the internal pointer */ + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + + /* parse the array to look for our key */ + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) tmp) == SUCCESS) { + /* ensure the key is a string */ + if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), string_key, string_len, num_key, 0, NULL) == HASH_KEY_IS_STRING) { + /* compare to our key */ + if (!strncmp(string_key, key, string_len)) { + return Z_STRVAL_PP(tmp); + } + } + zend_hash_move_forward(Z_ARRVAL_PP(data)); + } + } + + return NULL; +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_php.h b/sapi/fpm/fpm/fpm_php.h index a2c7ed3..d605473 100644 --- a/sapi/fpm/fpm/fpm_php.h +++ b/sapi/fpm/fpm/fpm_php.h @@ -44,6 +44,7 @@ void fpm_php_soft_quit(); int fpm_php_init_main(); int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode); int fpm_php_limit_extensions(char *path); +char* fpm_php_get_string_from_table(char *table, char *key TSRMLS_DC); #endif diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 83de76d..5f2c852 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -14,6 +14,7 @@ #include zlog.h #include fpm_atomic.h #include fpm_conf.h +#include fpm_php.h #include ext/standard/html.h static char *fpm_status_uri = NULL; @@ -125,13 +126,13 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* full status ? */ - full = SG(request_info).request_uri strstr(SG(request_info).query_string, full); + full = (fpm_php_get_string_from_table(_GET, full TSRMLS_CC) != NULL); short_syntax = short_post = NULL; full_separator = full_pre = full_syntax = full_post = NULL; encode = 0; /* HTML */ - if (SG(request_info).query_string strstr(SG(request_info).query_string, html)) { + if (fpm_php_get_string_from_table(_GET, html TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL(Content-Type: text/html), 1, 1 TSRMLS_CC); time_format = %d/%b/%Y:%H:%M:%S %z; encode = 1; @@ -205,7 +206,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* XML */ - } else if (SG(request_info).request_uri strstr(SG(request_info).query_string, xml)) { + } else if (fpm_php_get_string_from_table(_GET, xml TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL(Content-Type: text/xml), 1, 1 TSRMLS_CC); time_format = %s; encode = 1; @@ -256,7 +257,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* JSON */ - } else if (SG(request_info).request_uri strstr(SG(request_info).query_string, json)) { + } else if (fpm_php_get_string_from_table(_GET, json TSRMLS_CC)) { sapi_add_header_ex(ZEND_STRL(Content-Type: application/json), 1, 1 TSRMLS_CC); time_format = %s; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Comment unused function to avoid warnings: sapi/fpm/fpm/fpm_conf.c
Commit:34b6a9b32cb1271441a8fa9f39f13d33f3a3e9ec Author:Jerome Loyet f...@php.net Fri, 1 Jun 2012 11:26:39 +0200 Parents: e7a7f533e32813b13255efa236b711f6d1f6325d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=34b6a9b32cb1271441a8fa9f39f13d33f3a3e9ec Log: - Comment unused function to avoid warnings Changed paths: M sapi/fpm/fpm/fpm_conf.c Diff: diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 1f3258f..dfe6792 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -53,7 +53,9 @@ static int fpm_conf_load_ini_file(char *filename TSRMLS_DC); static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset); +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset); +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_boolean(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset); @@ -242,6 +244,7 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) / } /* }}} */ +#if 0 /* not used for now */ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* {{{ */ { char *val = Z_STRVAL_P(value); @@ -257,6 +260,7 @@ static char *fpm_conf_set_long(zval *value, void **config, intptr_t offset) /* { return NULL; } /* }}} */ +#endif static char *fpm_conf_set_time(zval *value, void **config, intptr_t offset) /* {{{ */ { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - add missing headers to avoid warnings: sapi/fpm/fpm/fpm_sockets.h
Commit:0037598252b8cbe117a592cf4f5261aa786fa722 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 17:38:08 +0200 Parents: d90003b5491c576ab28c3999c8f3121d6c0d06f1 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0037598252b8cbe117a592cf4f5261aa786fa722 Log: - add missing headers to avoid warnings Changed paths: M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index b7ff0b2..5b9c698 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -5,6 +5,8 @@ #ifndef FPM_MISC_H #define FPM_MISC_H 1 +#include sys/types.h +#include sys/socket.h #include unistd.h #include fcntl.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - add missing headers to avoid warnings: sapi/fpm/fpm/fpm_sockets.h
Commit:63e11f90258d26de20f1756120da6f351eff3f91 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 17:37:33 +0200 Parents: a7761262f70d660cd20ec698c453b8daa922f422 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=63e11f90258d26de20f1756120da6f351eff3f91 Log: - add missing headers to avoid warnings Changed paths: M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index b7ff0b2..5b9c698 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -5,6 +5,8 @@ #ifndef FPM_MISC_H #define FPM_MISC_H 1 +#include sys/types.h +#include sys/socket.h #include unistd.h #include fcntl.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - add missing headers to avoid warnings: sapi/fpm/fpm/fpm_sockets.h
Commit:18cd5772d61ec302bba6be2baee742a1890c12f8 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 17:38:39 +0200 Parents: eeba67914ebe02de279f0188be739b78c7a76958 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=18cd5772d61ec302bba6be2baee742a1890c12f8 Log: - add missing headers to avoid warnings Changed paths: M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index b7ff0b2..5b9c698 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -5,6 +5,8 @@ #ifndef FPM_MISC_H #define FPM_MISC_H 1 +#include sys/types.h +#include sys/socket.h #include unistd.h #include fcntl.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62160 (Add process.priority to set nice(2) priorities): NEWS sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/fpm/fpm_unix.c sapi/fpm/php-fpm.conf.in
Commit:f6655b62d8273a4d1276d98491bf49bb197821fe Author:Jerome Loyet f...@php.net Sat, 26 May 2012 18:22:12 +0200 Parents: 63e11f90258d26de20f1756120da6f351eff3f91 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f6655b62d8273a4d1276d98491bf49bb197821fe Log: - Fixed bug #62160 (Add process.priority to set nice(2) priorities) Bugs: https://bugs.php.net/62160 Changed paths: M NEWS M sapi/fpm/fpm/fpm_conf.c M sapi/fpm/fpm/fpm_conf.h M sapi/fpm/fpm/fpm_unix.c M sapi/fpm/php-fpm.conf.in diff --git a/NEWS b/NEWS index 60991b6..3981b1f 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ PHP NEWS (fat) . Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors). (fat) + . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) - Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index a4283a2..1f3258f 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -70,6 +70,7 @@ struct fpm_global_config_s fpm_global_config = { .syslog_facility = -1, #endif .process_max = 0, + .process_priority = 64, /* 64 means unset */ }; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; @@ -92,6 +93,7 @@ static struct ini_value_parser_s ini_fpm_global_options[] = { { emergency_restart_interval, fpm_conf_set_time, GO(emergency_restart_interval) }, { process_control_timeout, fpm_conf_set_time, GO(process_control_timeout) }, { process.max, fpm_conf_set_integer, GO(process_max) }, + { process.priority,fpm_conf_set_integer, GO(process_priority) }, { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { rlimit_files,fpm_conf_set_integer, GO(rlimit_files) }, { rlimit_core, fpm_conf_set_rlimit_core, GO(rlimit_core) }, @@ -112,6 +114,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = { { listen.group, fpm_conf_set_string, WPO(listen_group) }, { listen.mode, fpm_conf_set_string, WPO(listen_mode) }, { listen.allowed_clients,fpm_conf_set_string, WPO(listen_allowed_clients) }, + { process.priority, fpm_conf_set_integer, WPO(process_priority) }, { pm,fpm_conf_set_pm, WPO(pm) }, { pm.max_children, fpm_conf_set_integer, WPO(pm_max_children) }, { pm.start_servers, fpm_conf_set_integer, WPO(pm_start_servers) }, @@ -577,6 +580,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */ memset(wp-config, 0, sizeof(struct fpm_worker_pool_config_s)); wp-config-listen_backlog = FPM_BACKLOG_DEFAULT; wp-config-pm_process_idle_timeout = 10; /* 10s by default */ + wp-config-process_priority = 64; /* 64 means unset */ if (!fpm_worker_all_pools) { fpm_worker_all_pools = wp; @@ -741,6 +745,11 @@ static int fpm_conf_process_all_pools() /* {{{ */ return -1; } + if (wp-config-process_priority != 64 (wp-config-process_priority -19 || wp-config-process_priority 20)) { + zlog(ZLOG_ERROR, [pool %s] process.priority must be included into [-19,20], wp-config-name); + return -1; + } + /* pm */ if (wp-config-pm != PM_STYLE_STATIC wp-config-pm != PM_STYLE_DYNAMIC wp-config-pm != PM_STYLE_ONDEMAND) { zlog(ZLOG_ALERT, [pool %s] the process manager is missing (static, dynamic or ondemand), wp-config-name); @@ -1117,6 +1126,11 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */ return -1; } + if (fpm_global_config.process_priority != 64 (fpm_global_config.process_priority -19 || fpm_global_config.process_priority 20)) { + zlog(ZLOG_ERROR, process.priority must be included into [-19,20]); + return -1; + } + if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup(log/php-fpm.log); } @@ -1499,6 +1513,11 @@ static void fpm_conf_dump() /* {{{ */ zlog(ZLOG_NOTICE, \temergency_restart_threshold = %d, fpm_global_config.emergency_restart_threshold); zlog(ZLOG_NOTICE, \tprocess_control_timeout = %ds, fpm_global_config.process_control_timeout); zlog(ZLOG_NOTICE, \tprocess.max = %d, fpm_global_config.process_max); + if (fpm_global_config.process_priority == 64) { + zlog(ZLOG_NOTICE, \tprocess.priority = undefined); + } else {
[PHP-CVS] com php-src: - Fixed bug #62160 (Add process.priority to set nice(2) priorities): NEWS sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/fpm/fpm_unix.c sapi/fpm/php-fpm.conf.in
Commit:decc394a2089b955a175aed0091044d0fc3d1aab Author:Jerome Loyet f...@php.net Sat, 26 May 2012 18:24:08 +0200 Parents: 0037598252b8cbe117a592cf4f5261aa786fa722 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=decc394a2089b955a175aed0091044d0fc3d1aab Log: - Fixed bug #62160 (Add process.priority to set nice(2) priorities) Bugs: https://bugs.php.net/62160 Changed paths: M NEWS M sapi/fpm/fpm/fpm_conf.c M sapi/fpm/fpm/fpm_conf.h M sapi/fpm/fpm/fpm_unix.c M sapi/fpm/php-fpm.conf.in diff --git a/NEWS b/NEWS index f14ad6c..8314eda 100644 --- a/NEWS +++ b/NEWS @@ -65,6 +65,7 @@ PHP NEWS (fat) . Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors). (fat) + . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) - Intl . ResourceBundle constructor now accepts NULL for the first two arguments. diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index a4283a2..1f3258f 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -70,6 +70,7 @@ struct fpm_global_config_s fpm_global_config = { .syslog_facility = -1, #endif .process_max = 0, + .process_priority = 64, /* 64 means unset */ }; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; @@ -92,6 +93,7 @@ static struct ini_value_parser_s ini_fpm_global_options[] = { { emergency_restart_interval, fpm_conf_set_time, GO(emergency_restart_interval) }, { process_control_timeout, fpm_conf_set_time, GO(process_control_timeout) }, { process.max, fpm_conf_set_integer, GO(process_max) }, + { process.priority,fpm_conf_set_integer, GO(process_priority) }, { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { rlimit_files,fpm_conf_set_integer, GO(rlimit_files) }, { rlimit_core, fpm_conf_set_rlimit_core, GO(rlimit_core) }, @@ -112,6 +114,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = { { listen.group, fpm_conf_set_string, WPO(listen_group) }, { listen.mode, fpm_conf_set_string, WPO(listen_mode) }, { listen.allowed_clients,fpm_conf_set_string, WPO(listen_allowed_clients) }, + { process.priority, fpm_conf_set_integer, WPO(process_priority) }, { pm,fpm_conf_set_pm, WPO(pm) }, { pm.max_children, fpm_conf_set_integer, WPO(pm_max_children) }, { pm.start_servers, fpm_conf_set_integer, WPO(pm_start_servers) }, @@ -577,6 +580,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */ memset(wp-config, 0, sizeof(struct fpm_worker_pool_config_s)); wp-config-listen_backlog = FPM_BACKLOG_DEFAULT; wp-config-pm_process_idle_timeout = 10; /* 10s by default */ + wp-config-process_priority = 64; /* 64 means unset */ if (!fpm_worker_all_pools) { fpm_worker_all_pools = wp; @@ -741,6 +745,11 @@ static int fpm_conf_process_all_pools() /* {{{ */ return -1; } + if (wp-config-process_priority != 64 (wp-config-process_priority -19 || wp-config-process_priority 20)) { + zlog(ZLOG_ERROR, [pool %s] process.priority must be included into [-19,20], wp-config-name); + return -1; + } + /* pm */ if (wp-config-pm != PM_STYLE_STATIC wp-config-pm != PM_STYLE_DYNAMIC wp-config-pm != PM_STYLE_ONDEMAND) { zlog(ZLOG_ALERT, [pool %s] the process manager is missing (static, dynamic or ondemand), wp-config-name); @@ -1117,6 +1126,11 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */ return -1; } + if (fpm_global_config.process_priority != 64 (fpm_global_config.process_priority -19 || fpm_global_config.process_priority 20)) { + zlog(ZLOG_ERROR, process.priority must be included into [-19,20]); + return -1; + } + if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup(log/php-fpm.log); } @@ -1499,6 +1513,11 @@ static void fpm_conf_dump() /* {{{ */ zlog(ZLOG_NOTICE, \temergency_restart_threshold = %d, fpm_global_config.emergency_restart_threshold); zlog(ZLOG_NOTICE, \tprocess_control_timeout = %ds, fpm_global_config.process_control_timeout); zlog(ZLOG_NOTICE, \tprocess.max = %d, fpm_global_config.process_max); + if (fpm_global_config.process_priority == 64) { + zlog(ZLOG_NOTICE, \tprocess.priority = undefined); +
[PHP-CVS] com php-src: - Fixed bug #62160 (Add process.priority to set nice(2) priorities): sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/fpm/fpm_unix.c sapi/fpm/php-fpm.conf.in
Commit:7127135c8705d947a01ee637444c1db2adf37b1d Author:Jerome Loyet f...@php.net Sat, 26 May 2012 18:24:28 +0200 Parents: 18cd5772d61ec302bba6be2baee742a1890c12f8 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7127135c8705d947a01ee637444c1db2adf37b1d Log: - Fixed bug #62160 (Add process.priority to set nice(2) priorities) Bugs: https://bugs.php.net/62160 Changed paths: M sapi/fpm/fpm/fpm_conf.c M sapi/fpm/fpm/fpm_conf.h M sapi/fpm/fpm/fpm_unix.c M sapi/fpm/php-fpm.conf.in diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index a4283a2..1f3258f 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -70,6 +70,7 @@ struct fpm_global_config_s fpm_global_config = { .syslog_facility = -1, #endif .process_max = 0, + .process_priority = 64, /* 64 means unset */ }; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; @@ -92,6 +93,7 @@ static struct ini_value_parser_s ini_fpm_global_options[] = { { emergency_restart_interval, fpm_conf_set_time, GO(emergency_restart_interval) }, { process_control_timeout, fpm_conf_set_time, GO(process_control_timeout) }, { process.max, fpm_conf_set_integer, GO(process_max) }, + { process.priority,fpm_conf_set_integer, GO(process_priority) }, { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { rlimit_files,fpm_conf_set_integer, GO(rlimit_files) }, { rlimit_core, fpm_conf_set_rlimit_core, GO(rlimit_core) }, @@ -112,6 +114,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = { { listen.group, fpm_conf_set_string, WPO(listen_group) }, { listen.mode, fpm_conf_set_string, WPO(listen_mode) }, { listen.allowed_clients,fpm_conf_set_string, WPO(listen_allowed_clients) }, + { process.priority, fpm_conf_set_integer, WPO(process_priority) }, { pm,fpm_conf_set_pm, WPO(pm) }, { pm.max_children, fpm_conf_set_integer, WPO(pm_max_children) }, { pm.start_servers, fpm_conf_set_integer, WPO(pm_start_servers) }, @@ -577,6 +580,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */ memset(wp-config, 0, sizeof(struct fpm_worker_pool_config_s)); wp-config-listen_backlog = FPM_BACKLOG_DEFAULT; wp-config-pm_process_idle_timeout = 10; /* 10s by default */ + wp-config-process_priority = 64; /* 64 means unset */ if (!fpm_worker_all_pools) { fpm_worker_all_pools = wp; @@ -741,6 +745,11 @@ static int fpm_conf_process_all_pools() /* {{{ */ return -1; } + if (wp-config-process_priority != 64 (wp-config-process_priority -19 || wp-config-process_priority 20)) { + zlog(ZLOG_ERROR, [pool %s] process.priority must be included into [-19,20], wp-config-name); + return -1; + } + /* pm */ if (wp-config-pm != PM_STYLE_STATIC wp-config-pm != PM_STYLE_DYNAMIC wp-config-pm != PM_STYLE_ONDEMAND) { zlog(ZLOG_ALERT, [pool %s] the process manager is missing (static, dynamic or ondemand), wp-config-name); @@ -1117,6 +1126,11 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */ return -1; } + if (fpm_global_config.process_priority != 64 (fpm_global_config.process_priority -19 || fpm_global_config.process_priority 20)) { + zlog(ZLOG_ERROR, process.priority must be included into [-19,20]); + return -1; + } + if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup(log/php-fpm.log); } @@ -1499,6 +1513,11 @@ static void fpm_conf_dump() /* {{{ */ zlog(ZLOG_NOTICE, \temergency_restart_threshold = %d, fpm_global_config.emergency_restart_threshold); zlog(ZLOG_NOTICE, \tprocess_control_timeout = %ds, fpm_global_config.process_control_timeout); zlog(ZLOG_NOTICE, \tprocess.max = %d, fpm_global_config.process_max); + if (fpm_global_config.process_priority == 64) { + zlog(ZLOG_NOTICE, \tprocess.priority = undefined); + } else { + zlog(ZLOG_NOTICE, \tprocess.priority = %d, fpm_global_config.process_priority); + } zlog(ZLOG_NOTICE, \tdaemonize = %s, BOOL2STR(fpm_global_config.daemonize)); zlog(ZLOG_NOTICE, \trlimit_files = %d, fpm_global_config.rlimit_files); zlog(ZLOG_NOTICE, \trlimit_core = %d, fpm_global_config.rlimit_core); @@ -1518,6 +1537,11 @@ static void fpm_conf_dump() /* {{{ */
[PHP-CVS] com php-src: Fixed bug #62033 (USR2 signal was sent even if not catch when daemonize and an error occured): sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/fpm_uni
Commit:0225300b7067f4396e2bce57d549b8da9126c33e Author:Jerome Loyet f...@php.net Sat, 26 May 2012 18:48:56 +0200 Parents: 7127135c8705d947a01ee637444c1db2adf37b1d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0225300b7067f4396e2bce57d549b8da9126c33e Log: Fixed bug #62033 (USR2 signal was sent even if not catch when daemonize and an error occured) Bugs: https://bugs.php.net/62033 Changed paths: M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 176dbaf..dab415d 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -39,6 +39,7 @@ struct fpm_globals_s fpm_globals = { .test_successful = 0, .heartbeat = 0, .run_as_root = 0, + .send_config_signal = 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 b0bed0a..7a2903d 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -55,6 +55,7 @@ struct fpm_globals_s { int test_successful; int heartbeat; int run_as_root; + int send_config_signal; }; extern struct fpm_globals_s fpm_globals; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index c3fd2bc..83b461b 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1799,14 +1799,14 @@ 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_global_config.daemonize) { + if (fpm_globals.send_config_signal) { zlog(ZLOG_DEBUG, Sending SIGUSR2 (error) to parent %d, getppid()); kill(getppid(), SIGUSR2); } return FPM_EXIT_CONFIG; } - if (fpm_global_config.daemonize) { + if (fpm_globals.send_config_signal) { zlog(ZLOG_DEBUG, Sending SIGUSR1 (OK) to parent %d, getppid()); kill(getppid(), SIGUSR1); } diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 0f4d383..5c5e37c 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -305,6 +305,7 @@ int fpm_unix_init_main() /* {{{ */ /* restore USR1 and USR2 sigaction */ sigaction(SIGUSR1, oldact_usr1, NULL); sigaction(SIGUSR2, oldact_usr2, NULL); + fpm_globals.send_config_signal = 1; break; default : /* parent */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62033 (USR2 signal was sent even if not catch when daemonize and an error occured): sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/fpm_u
Commit:0298b92b69e5637e8d151790ad6369f7980a406a Author:Jerome Loyet f...@php.net Sat, 26 May 2012 18:44:35 +0200 Parents: f6655b62d8273a4d1276d98491bf49bb197821fe Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0298b92b69e5637e8d151790ad6369f7980a406a Log: - Fixed bug #62033 (USR2 signal was sent even if not catch when daemonize and an error occured) Bugs: https://bugs.php.net/62033 Changed paths: M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 176dbaf..dab415d 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -39,6 +39,7 @@ struct fpm_globals_s fpm_globals = { .test_successful = 0, .heartbeat = 0, .run_as_root = 0, + .send_config_signal = 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 b0bed0a..7a2903d 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -55,6 +55,7 @@ struct fpm_globals_s { int test_successful; int heartbeat; int run_as_root; + int send_config_signal; }; extern struct fpm_globals_s fpm_globals; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 08477da..9c314f5 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1804,14 +1804,14 @@ 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_global_config.daemonize) { + if (fpm_globals.send_config_signal) { zlog(ZLOG_DEBUG, Sending SIGUSR2 (error) to parent %d, getppid()); kill(getppid(), SIGUSR2); } return FPM_EXIT_CONFIG; } - if (fpm_global_config.daemonize) { + if (fpm_globals.send_config_signal) { zlog(ZLOG_DEBUG, Sending SIGUSR1 (OK) to parent %d, getppid()); kill(getppid(), SIGUSR1); } diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 0f4d383..5c5e37c 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -305,6 +305,7 @@ int fpm_unix_init_main() /* {{{ */ /* restore USR1 and USR2 sigaction */ sigaction(SIGUSR1, oldact_usr1, NULL); sigaction(SIGUSR2, oldact_usr2, NULL); + fpm_globals.send_config_signal = 1; break; default : /* parent */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #62033 (USR2 signal was sent even if not catch when daemonize and an error occured): sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/fpm_uni
Commit:e052da3a6bc353636fa4bf9cb488573c50adf9a0 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 18:48:40 +0200 Parents: decc394a2089b955a175aed0091044d0fc3d1aab Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e052da3a6bc353636fa4bf9cb488573c50adf9a0 Log: Fixed bug #62033 (USR2 signal was sent even if not catch when daemonize and an error occured) Bugs: https://bugs.php.net/62033 Changed paths: M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 176dbaf..dab415d 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -39,6 +39,7 @@ struct fpm_globals_s fpm_globals = { .test_successful = 0, .heartbeat = 0, .run_as_root = 0, + .send_config_signal = 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 b0bed0a..7a2903d 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -55,6 +55,7 @@ struct fpm_globals_s { int test_successful; int heartbeat; int run_as_root; + int send_config_signal; }; extern struct fpm_globals_s fpm_globals; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index c3fd2bc..83b461b 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1799,14 +1799,14 @@ 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_global_config.daemonize) { + if (fpm_globals.send_config_signal) { zlog(ZLOG_DEBUG, Sending SIGUSR2 (error) to parent %d, getppid()); kill(getppid(), SIGUSR2); } return FPM_EXIT_CONFIG; } - if (fpm_global_config.daemonize) { + if (fpm_globals.send_config_signal) { zlog(ZLOG_DEBUG, Sending SIGUSR1 (OK) to parent %d, getppid()); kill(getppid(), SIGUSR1); } diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 0f4d383..5c5e37c 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -305,6 +305,7 @@ int fpm_unix_init_main() /* {{{ */ /* restore USR1 and USR2 sigaction */ sigaction(SIGUSR1, oldact_usr1, NULL); sigaction(SIGUSR2, oldact_usr2, NULL); + fpm_globals.send_config_signal = 1; break; default : /* parent */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests): NEWS sapi/fpm/fpm/fastcgi.c
Commit:60cca8b9c9b879295dbf1f76e305882e347dcb53 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 19:27:45 +0200 Parents: e052da3a6bc353636fa4bf9cb488573c50adf9a0 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=60cca8b9c9b879295dbf1f76e305882e347dcb53 Log: Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests) Bugs: https://bugs.php.net/61218 Changed paths: M NEWS M sapi/fpm/fpm/fastcgi.c Diff: diff --git a/NEWS b/NEWS index 8314eda..eed55f1 100644 --- a/NEWS +++ b/NEWS @@ -66,6 +66,8 @@ PHP NEWS . Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors). (fat) . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) + . Fixed bug #61218 (FPM drops connection while receiving some binary values +in FastCGI requests). (fat) - Intl . ResourceBundle constructor now accepts NULL for the first two arguments. diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 212b6ff..9df26f1 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -395,39 +395,12 @@ static inline size_t fcgi_get_params_len( int *result, unsigned char *p, unsigne return ret; } -static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end, uint *eff_len) -{ - int ret = 1; - int zero_found = 0; -*eff_len = 0; - for (; p != end; ++p) { - if (*p == '\0') { - zero_found = 1; - } - else { - if (zero_found) { - ret = 0; - break; - } - if (*eff_len ((uint)-1)) { - ++*eff_len; - } - else { - ret = 0; - break; - } - } - } - return ret; -} - static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; size_t buf_size = sizeof(buf); int name_len, val_len; - uint eff_name_len, eff_val_len; char *s; int ret = 1; size_t bytes_consumed; @@ -453,32 +426,27 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e ret = 0; break; } - if (!fcgi_param_get_eff_len(p, p+name_len, eff_name_len) || - !fcgi_param_get_eff_len(p+name_len, p+name_len+val_len, eff_val_len)) { - /* Malicious request */ - ret = 0; - break; - } - if (eff_name_len = buf_size-1) { - if (eff_name_len ((uint)-1)-64) { + + if (name_len = buf_size-1) { + if (name_len ((uint)-1)-64) { ret = 0; break; } - buf_size = eff_name_len + 64; + buf_size = name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); if (tmp == NULL) { ret = 0; break; } } - memcpy(tmp, p, eff_name_len); - tmp[eff_name_len] = 0; - s = estrndup((char*)p + name_len, eff_val_len); + memcpy(tmp, p, name_len); + tmp[name_len] = 0; + s = estrndup((char*)p + name_len, val_len); if (s == NULL) { ret = 0; break; } - zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); + zend_hash_update(req-env, tmp, name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } if (tmp != buf tmp != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #61218 (FPM drops connection while receiving some binary valuesin FastCGI requests): NEWS sapi/fpm/fpm/fastcgi.c
Commit:e7ff3e839b4c2a3423729b07ba1d40f45f1d2983 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 19:27:02 +0200 Parents: 0298b92b69e5637e8d151790ad6369f7980a406a Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e7ff3e839b4c2a3423729b07ba1d40f45f1d2983 Log: Fixed bug #61218 (FPM drops connection while receiving some binary valuesin FastCGI requests) Bugs: https://bugs.php.net/61218 Changed paths: M NEWS M sapi/fpm/fpm/fastcgi.c Diff: diff --git a/NEWS b/NEWS index 3981b1f..6863a73 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,8 @@ PHP NEWS . Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors). (fat) . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) + . Fixed bug #61218 (FPM drops connection while receiving some binary values +in FastCGI requests). (fat) - Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 212b6ff..9df26f1 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -395,39 +395,12 @@ static inline size_t fcgi_get_params_len( int *result, unsigned char *p, unsigne return ret; } -static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end, uint *eff_len) -{ - int ret = 1; - int zero_found = 0; -*eff_len = 0; - for (; p != end; ++p) { - if (*p == '\0') { - zero_found = 1; - } - else { - if (zero_found) { - ret = 0; - break; - } - if (*eff_len ((uint)-1)) { - ++*eff_len; - } - else { - ret = 0; - break; - } - } - } - return ret; -} - static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; size_t buf_size = sizeof(buf); int name_len, val_len; - uint eff_name_len, eff_val_len; char *s; int ret = 1; size_t bytes_consumed; @@ -453,32 +426,27 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e ret = 0; break; } - if (!fcgi_param_get_eff_len(p, p+name_len, eff_name_len) || - !fcgi_param_get_eff_len(p+name_len, p+name_len+val_len, eff_val_len)) { - /* Malicious request */ - ret = 0; - break; - } - if (eff_name_len = buf_size-1) { - if (eff_name_len ((uint)-1)-64) { + + if (name_len = buf_size-1) { + if (name_len ((uint)-1)-64) { ret = 0; break; } - buf_size = eff_name_len + 64; + buf_size = name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); if (tmp == NULL) { ret = 0; break; } } - memcpy(tmp, p, eff_name_len); - tmp[eff_name_len] = 0; - s = estrndup((char*)p + name_len, eff_val_len); + memcpy(tmp, p, name_len); + tmp[name_len] = 0; + s = estrndup((char*)p + name_len, val_len); if (s == NULL) { ret = 0; break; } - zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); + zend_hash_update(req-env, tmp, name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } if (tmp != buf tmp != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests): sapi/fpm/fpm/fastcgi.c
Commit:78de6eb03d3a24691d9f535e2cbe768a9ba8bd48 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 19:29:01 +0200 Parents: 0225300b7067f4396e2bce57d549b8da9126c33e Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=78de6eb03d3a24691d9f535e2cbe768a9ba8bd48 Log: Fixed bug #61218 (FPM drops connection while receiving some binary values in FastCGI requests) Bugs: https://bugs.php.net/61218 Changed paths: M sapi/fpm/fpm/fastcgi.c Diff: diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 212b6ff..9df26f1 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -395,39 +395,12 @@ static inline size_t fcgi_get_params_len( int *result, unsigned char *p, unsigne return ret; } -static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end, uint *eff_len) -{ - int ret = 1; - int zero_found = 0; -*eff_len = 0; - for (; p != end; ++p) { - if (*p == '\0') { - zero_found = 1; - } - else { - if (zero_found) { - ret = 0; - break; - } - if (*eff_len ((uint)-1)) { - ++*eff_len; - } - else { - ret = 0; - break; - } - } - } - return ret; -} - static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; size_t buf_size = sizeof(buf); int name_len, val_len; - uint eff_name_len, eff_val_len; char *s; int ret = 1; size_t bytes_consumed; @@ -453,32 +426,27 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e ret = 0; break; } - if (!fcgi_param_get_eff_len(p, p+name_len, eff_name_len) || - !fcgi_param_get_eff_len(p+name_len, p+name_len+val_len, eff_val_len)) { - /* Malicious request */ - ret = 0; - break; - } - if (eff_name_len = buf_size-1) { - if (eff_name_len ((uint)-1)-64) { + + if (name_len = buf_size-1) { + if (name_len ((uint)-1)-64) { ret = 0; break; } - buf_size = eff_name_len + 64; + buf_size = name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); if (tmp == NULL) { ret = 0; break; } } - memcpy(tmp, p, eff_name_len); - tmp[eff_name_len] = 0; - s = estrndup((char*)p + name_len, eff_val_len); + memcpy(tmp, p, name_len); + tmp[name_len] = 0; + s = estrndup((char*)p + name_len, val_len); if (s == NULL) { ret = 0; break; } - zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); + zend_hash_update(req-env, tmp, name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } if (tmp != buf tmp != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #61218 (the previous patch was not enough restritive on fcgi name string checks): sapi/fpm/fpm/fastcgi.c
Commit:2f7bd57f930bcfdc97b7472fbe6a502cafdc5a59 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 19:36:01 +0200 Parents: e7ff3e839b4c2a3423729b07ba1d40f45f1d2983 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2f7bd57f930bcfdc97b7472fbe6a502cafdc5a59 Log: Fixed bug #61218 (the previous patch was not enough restritive on fcgi name string checks) Bugs: https://bugs.php.net/61218 Changed paths: M sapi/fpm/fpm/fastcgi.c Diff: diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 9df26f1..e2e208a 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -395,12 +395,39 @@ static inline size_t fcgi_get_params_len( int *result, unsigned char *p, unsigne return ret; } +static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end, uint *eff_len) +{ + int ret = 1; + int zero_found = 0; + *eff_len = 0; + for (; p != end; ++p) { + if (*p == '\0') { + zero_found = 1; + } + else { + if (zero_found) { + ret = 0; + break; + } + if (*eff_len ((uint)-1)) { + ++*eff_len; + } + else { + ret = 0; + break; + } + } + } + return ret; +} + static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; size_t buf_size = sizeof(buf); int name_len, val_len; + uint eff_name_len; char *s; int ret = 1; size_t bytes_consumed; @@ -427,26 +454,35 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e break; } - if (name_len = buf_size-1) { - if (name_len ((uint)-1)-64) { + /* +* get the effective length of the name in case it's not a valid string +* don't do this on the value because it can be binary data +*/ + if (!fcgi_param_get_eff_len(p, p+name_len, eff_name_len)){ + /* Malicious request */ + ret = 0; + break; + } + if (eff_name_len = buf_size-1) { + if (eff_name_len ((uint)-1)-64) { ret = 0; break; } - buf_size = name_len + 64; + buf_size = eff_name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); if (tmp == NULL) { ret = 0; break; } } - memcpy(tmp, p, name_len); - tmp[name_len] = 0; + memcpy(tmp, p, eff_name_len); + tmp[eff_name_len] = 0; s = estrndup((char*)p + name_len, val_len); if (s == NULL) { ret = 0; break; } - zend_hash_update(req-env, tmp, name_len+1, s, sizeof(char*), NULL); + zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } if (tmp != buf tmp != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #61218 (the previous patch was not enough restritive on fcgi name string checks): sapi/fpm/fpm/fastcgi.c
Commit:773e85a788de7dc557201d4af2cb10250c049052 Author:Jerome Loyet f...@php.net Sat, 26 May 2012 19:37:09 +0200 Parents: 60cca8b9c9b879295dbf1f76e305882e347dcb53 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=773e85a788de7dc557201d4af2cb10250c049052 Log: Fixed bug #61218 (the previous patch was not enough restritive on fcgi name string checks) Bugs: https://bugs.php.net/61218 Changed paths: M sapi/fpm/fpm/fastcgi.c Diff: diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 9df26f1..e2e208a 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -395,12 +395,39 @@ static inline size_t fcgi_get_params_len( int *result, unsigned char *p, unsigne return ret; } +static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end, uint *eff_len) +{ + int ret = 1; + int zero_found = 0; + *eff_len = 0; + for (; p != end; ++p) { + if (*p == '\0') { + zero_found = 1; + } + else { + if (zero_found) { + ret = 0; + break; + } + if (*eff_len ((uint)-1)) { + ++*eff_len; + } + else { + ret = 0; + break; + } + } + } + return ret; +} + static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; size_t buf_size = sizeof(buf); int name_len, val_len; + uint eff_name_len; char *s; int ret = 1; size_t bytes_consumed; @@ -427,26 +454,35 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e break; } - if (name_len = buf_size-1) { - if (name_len ((uint)-1)-64) { + /* +* get the effective length of the name in case it's not a valid string +* don't do this on the value because it can be binary data +*/ + if (!fcgi_param_get_eff_len(p, p+name_len, eff_name_len)){ + /* Malicious request */ + ret = 0; + break; + } + if (eff_name_len = buf_size-1) { + if (eff_name_len ((uint)-1)-64) { ret = 0; break; } - buf_size = name_len + 64; + buf_size = eff_name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); if (tmp == NULL) { ret = 0; break; } } - memcpy(tmp, p, name_len); - tmp[name_len] = 0; + memcpy(tmp, p, eff_name_len); + tmp[eff_name_len] = 0; s = estrndup((char*)p + name_len, val_len); if (s == NULL) { ret = 0; break; } - zend_hash_update(req-env, tmp, name_len+1, s, sizeof(char*), NULL); + zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } if (tmp != buf tmp != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #61218 (the previous patch was not enough restritive on fcgi name string checks): sapi/fpm/fpm/fastcgi.c
Commit:e7a7f533e32813b13255efa236b711f6d1f6325d Author:Jerome Loyet f...@php.net Sat, 26 May 2012 19:37:24 +0200 Parents: 78de6eb03d3a24691d9f535e2cbe768a9ba8bd48 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e7a7f533e32813b13255efa236b711f6d1f6325d Log: Fixed bug #61218 (the previous patch was not enough restritive on fcgi name string checks) Bugs: https://bugs.php.net/61218 Changed paths: M sapi/fpm/fpm/fastcgi.c Diff: diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 9df26f1..e2e208a 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -395,12 +395,39 @@ static inline size_t fcgi_get_params_len( int *result, unsigned char *p, unsigne return ret; } +static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end, uint *eff_len) +{ + int ret = 1; + int zero_found = 0; + *eff_len = 0; + for (; p != end; ++p) { + if (*p == '\0') { + zero_found = 1; + } + else { + if (zero_found) { + ret = 0; + break; + } + if (*eff_len ((uint)-1)) { + ++*eff_len; + } + else { + ret = 0; + break; + } + } + } + return ret; +} + static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *end) { char buf[128]; char *tmp = buf; size_t buf_size = sizeof(buf); int name_len, val_len; + uint eff_name_len; char *s; int ret = 1; size_t bytes_consumed; @@ -427,26 +454,35 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e break; } - if (name_len = buf_size-1) { - if (name_len ((uint)-1)-64) { + /* +* get the effective length of the name in case it's not a valid string +* don't do this on the value because it can be binary data +*/ + if (!fcgi_param_get_eff_len(p, p+name_len, eff_name_len)){ + /* Malicious request */ + ret = 0; + break; + } + if (eff_name_len = buf_size-1) { + if (eff_name_len ((uint)-1)-64) { ret = 0; break; } - buf_size = name_len + 64; + buf_size = eff_name_len + 64; tmp = (tmp == buf ? emalloc(buf_size): erealloc(tmp, buf_size)); if (tmp == NULL) { ret = 0; break; } } - memcpy(tmp, p, name_len); - tmp[name_len] = 0; + memcpy(tmp, p, eff_name_len); + tmp[eff_name_len] = 0; s = estrndup((char*)p + name_len, val_len); if (s == NULL) { ret = 0; break; } - zend_hash_update(req-env, tmp, name_len+1, s, sizeof(char*), NULL); + zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } if (tmp != buf tmp != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62033 (php-fpm exits with status 0 on some failures to start).: sapi/fpm/config.m4 sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_children.c sapi/fpm/fpm/fp
Commit:a28fe034f2d5253e0fbefafc6a7938df9db7319e Author:Jerome Loyet f...@php.net Fri, 25 May 2012 21:15:06 +0200 Parents: 61a13773bcbf761ecc03faa99877d3cac90529a0 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a28fe034f2d5253e0fbefafc6a7938df9db7319e Log: - Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). Bugs: https://bugs.php.net/62033 Changed paths: M sapi/fpm/config.m4 M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_children.c M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_process_ctl.c M sapi/fpm/fpm/fpm_signals.c M sapi/fpm/fpm/fpm_signals.h M sapi/fpm/fpm/fpm_unix.c diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 6c860c9..ad46717 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -16,6 +16,7 @@ AC_DEFUN([AC_FPM_STDLIBS], AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h]) AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) + AC_CHECK_HEADERS([sysexits.h]) ]) AC_DEFUN([AC_FPM_PRCTL], diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 909902b..176dbaf 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -66,7 +66,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t 0 fpm_event_init_main()) { if (fpm_globals.test_successful) { - exit(0); + exit(FPM_EXIT_OK); } else { zlog(ZLOG_ERROR, FPM initialization failed); return -1; diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index 2a69cb2..b0bed0a 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -7,6 +7,35 @@ #include unistd.h +#ifdef HAVE_SYSEXITS_H +#include sysexits.h +#endif + +#ifdef EX_OK +#define FPM_EXIT_OK EX_OK +#else +#define FPM_EXIT_OK 0 +#endif + +#ifdef EX_USAGE +#define FPM_EXIT_USAGE EX_USAGE +#else +#define FPM_EXIT_USAGE 64 +#endif + +#ifdef EX_SOFTWARE +#define FPM_EXIT_SOFTWARE EX_SOFTWARE +#else +#define FPM_EXIT_SOFTWARE 70 +#endif + +#ifdef EX_CONFIG +#define FPM_EXIT_CONFIG EX_CONFIG +#else +#define FPM_EXIT_CONFIG 78 +#endif + + 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); diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index 35058b0..84a9474 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -156,7 +156,7 @@ static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */ 0 fpm_php_init_child(wp)) { zlog(ZLOG_ERROR, [pool %s] child failed to initialize, wp-config-name); - exit(255); + exit(FPM_EXIT_SOFTWARE); } } /* }}} */ @@ -198,7 +198,7 @@ void fpm_children_bury() /* {{{ */ restart_child = 0; } - if (WEXITSTATUS(status) != 0) { + if (WEXITSTATUS(status) != FPM_EXIT_OK) { severity = ZLOG_WARNING; } diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 130673f..c3fd2bc 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1528,7 +1528,7 @@ static zend_module_entry cgi_module_entry = { */ int main(int argc, char *argv[]) { - int exit_status = SUCCESS; + int exit_status = FPM_EXIT_OK; int cgi = 0, c, use_extended_info = 0; zend_file_handle file_handle; @@ -1659,7 +1659,7 @@ int main(int argc, char *argv[]) php_output_end_all(TSRMLS_C); php_output_deactivate(TSRMLS_C); fcgi_shutdown(); - exit_status = 0; + exit_status = FPM_EXIT_OK; goto out; case 'i': /* php info quit */ @@ -1680,7 +1680,7 @@ int main(int argc, char *argv[]) php_output_end_all(TSRMLS_C); php_output_deactivate(TSRMLS_C); fcgi_shutdown(); - exit_status = 0; + exit_status = (c == 'h') ? FPM_EXIT_OK : FPM_EXIT_USAGE; goto out; case 'v': /* show php version quit */ @@ -1688,7 +1688,7 @@ int main(int argc, char *argv[]) if (php_request_startup(TSRMLS_C) == FAILURE) { SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); - return FAILURE; + return FPM_EXIT_SOFTWARE;
[PHP-CVS] com php-src: - Fixed bug #62033 (php-fpm exits with status 0 on some failures to start): NEWS sapi/fpm/config.m4 sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_children.c sapi/fpm/fp
Commit:bf9120ecae6e4653dbb5a1b0576f0b163afd6846 Author:Jerome Loyet f...@php.net Fri, 25 May 2012 21:10:17 +0200 Parents: c3547f19359c7150a9bbd35aa2a7adc9da900da5 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bf9120ecae6e4653dbb5a1b0576f0b163afd6846 Log: - Fixed bug #62033 (php-fpm exits with status 0 on some failures to start) Bugs: https://bugs.php.net/62033 Changed paths: M NEWS M sapi/fpm/config.m4 M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_children.c M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_process_ctl.c M sapi/fpm/fpm/fpm_signals.c M sapi/fpm/fpm/fpm_signals.h M sapi/fpm/fpm/fpm_unix.c diff --git a/NEWS b/NEWS index 5a748d2..bb6a36e 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ PHP NEWS . Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start). (fat) . Fixed bug #61026 (FPM pools can listen on the same address). (fat) + . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). +(fat) - Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 953fa1f..c23485a 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -16,6 +16,7 @@ AC_DEFUN([AC_FPM_STDLIBS], AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h]) AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) + AC_CHECK_HEADERS([sysexits.h]) ]) AC_DEFUN([AC_FPM_PRCTL], diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 909902b..176dbaf 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -66,7 +66,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t 0 fpm_event_init_main()) { if (fpm_globals.test_successful) { - exit(0); + exit(FPM_EXIT_OK); } else { zlog(ZLOG_ERROR, FPM initialization failed); return -1; diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index 2a69cb2..b0bed0a 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -7,6 +7,35 @@ #include unistd.h +#ifdef HAVE_SYSEXITS_H +#include sysexits.h +#endif + +#ifdef EX_OK +#define FPM_EXIT_OK EX_OK +#else +#define FPM_EXIT_OK 0 +#endif + +#ifdef EX_USAGE +#define FPM_EXIT_USAGE EX_USAGE +#else +#define FPM_EXIT_USAGE 64 +#endif + +#ifdef EX_SOFTWARE +#define FPM_EXIT_SOFTWARE EX_SOFTWARE +#else +#define FPM_EXIT_SOFTWARE 70 +#endif + +#ifdef EX_CONFIG +#define FPM_EXIT_CONFIG EX_CONFIG +#else +#define FPM_EXIT_CONFIG 78 +#endif + + 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); diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index 35058b0..84a9474 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -156,7 +156,7 @@ static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */ 0 fpm_php_init_child(wp)) { zlog(ZLOG_ERROR, [pool %s] child failed to initialize, wp-config-name); - exit(255); + exit(FPM_EXIT_SOFTWARE); } } /* }}} */ @@ -198,7 +198,7 @@ void fpm_children_bury() /* {{{ */ restart_child = 0; } - if (WEXITSTATUS(status) != 0) { + if (WEXITSTATUS(status) != FPM_EXIT_OK) { severity = ZLOG_WARNING; } diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 95a7623..08477da 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1538,7 +1538,7 @@ static zend_module_entry cgi_module_entry = { */ int main(int argc, char *argv[]) { - int exit_status = SUCCESS; + int exit_status = FPM_EXIT_OK; int cgi = 0, c; zend_file_handle file_handle; @@ -1668,7 +1668,7 @@ int main(int argc, char *argv[]) php_printf(\n); php_end_ob_buffers(1 TSRMLS_CC); fcgi_shutdown(); - exit_status = 0; + exit_status = FPM_EXIT_OK; goto out; case 'i': /* php info quit */ @@ -1689,7 +1689,7 @@ int main(int argc, char *argv[]) php_cgi_usage(argv[0]); php_end_ob_buffers(1 TSRMLS_CC); fcgi_shutdown(); - exit_status = 0; + exit_status = (c == 'h') ? FPM_EXIT_OK : FPM_EXIT_USAGE; goto out;
[PHP-CVS] com php-src: - Fixed bug #62033 (php-fpm exits with status 0 on some failures to start): NEWS sapi/fpm/config.m4 sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_children.c sapi/fpm/fp
Commit:c2f33fb1293cbcdc94daefb8583ca13e98b5c826 Author:Jerome Loyet f...@php.net Fri, 25 May 2012 21:13:57 +0200 Parents: 91ad40d9bbc772709fb9f88c55d7ce55f55df71b Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c2f33fb1293cbcdc94daefb8583ca13e98b5c826 Log: - Fixed bug #62033 (php-fpm exits with status 0 on some failures to start) Bugs: https://bugs.php.net/62033 Changed paths: M NEWS M sapi/fpm/config.m4 M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_children.c M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_process_ctl.c M sapi/fpm/fpm/fpm_signals.c M sapi/fpm/fpm/fpm_signals.h M sapi/fpm/fpm/fpm_unix.c diff --git a/NEWS b/NEWS index ac4eeb5..3da506f 100644 --- a/NEWS +++ b/NEWS @@ -61,6 +61,8 @@ PHP NEWS for non-root start). (fat) . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) . Fixed bug #61026 (FPM pools can listen on the same address). (fat) + . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). +(fat) - Intl . ResourceBundle constructor now accepts NULL for the first two arguments. diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 6c860c9..ad46717 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -16,6 +16,7 @@ AC_DEFUN([AC_FPM_STDLIBS], AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h]) AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) + AC_CHECK_HEADERS([sysexits.h]) ]) AC_DEFUN([AC_FPM_PRCTL], diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 909902b..176dbaf 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -66,7 +66,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t 0 fpm_event_init_main()) { if (fpm_globals.test_successful) { - exit(0); + exit(FPM_EXIT_OK); } else { zlog(ZLOG_ERROR, FPM initialization failed); return -1; diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index 2a69cb2..b0bed0a 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -7,6 +7,35 @@ #include unistd.h +#ifdef HAVE_SYSEXITS_H +#include sysexits.h +#endif + +#ifdef EX_OK +#define FPM_EXIT_OK EX_OK +#else +#define FPM_EXIT_OK 0 +#endif + +#ifdef EX_USAGE +#define FPM_EXIT_USAGE EX_USAGE +#else +#define FPM_EXIT_USAGE 64 +#endif + +#ifdef EX_SOFTWARE +#define FPM_EXIT_SOFTWARE EX_SOFTWARE +#else +#define FPM_EXIT_SOFTWARE 70 +#endif + +#ifdef EX_CONFIG +#define FPM_EXIT_CONFIG EX_CONFIG +#else +#define FPM_EXIT_CONFIG 78 +#endif + + 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); diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index 35058b0..84a9474 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -156,7 +156,7 @@ static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */ 0 fpm_php_init_child(wp)) { zlog(ZLOG_ERROR, [pool %s] child failed to initialize, wp-config-name); - exit(255); + exit(FPM_EXIT_SOFTWARE); } } /* }}} */ @@ -198,7 +198,7 @@ void fpm_children_bury() /* {{{ */ restart_child = 0; } - if (WEXITSTATUS(status) != 0) { + if (WEXITSTATUS(status) != FPM_EXIT_OK) { severity = ZLOG_WARNING; } diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 130673f..c3fd2bc 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1528,7 +1528,7 @@ static zend_module_entry cgi_module_entry = { */ int main(int argc, char *argv[]) { - int exit_status = SUCCESS; + int exit_status = FPM_EXIT_OK; int cgi = 0, c, use_extended_info = 0; zend_file_handle file_handle; @@ -1659,7 +1659,7 @@ int main(int argc, char *argv[]) php_output_end_all(TSRMLS_C); php_output_deactivate(TSRMLS_C); fcgi_shutdown(); - exit_status = 0; + exit_status = FPM_EXIT_OK; goto out; case 'i': /* php info quit */ @@ -1680,7 +1680,7 @@ int main(int argc, char *argv[]) php_output_end_all(TSRMLS_C); php_output_deactivate(TSRMLS_C); fcgi_shutdown(); - exit_status = 0; + exit_status = (c == 'h') ? FPM_EXIT_OK :
[PHP-CVS] com php-src: - Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors): NEWS sapi/fpm/fpm/fpm_sockets.c sapi/fpm/fpm/fpm_sockets.h
Commit:d90003b5491c576ab28c3999c8f3121d6c0d06f1 Author:Jerome Loyet f...@php.net Fri, 25 May 2012 21:22:54 +0200 Parents: c2f33fb1293cbcdc94daefb8583ca13e98b5c826 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d90003b5491c576ab28c3999c8f3121d6c0d06f1 Log: - Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors) Bugs: https://bugs.php.net/62153 Changed paths: M NEWS M sapi/fpm/fpm/fpm_sockets.c M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/NEWS b/NEWS index 3da506f..f14ad6c 100644 --- a/NEWS +++ b/NEWS @@ -63,6 +63,8 @@ PHP NEWS . Fixed bug #61026 (FPM pools can listen on the same address). (fat) . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). (fat) + . Fixed bug #62153 (when using unix sockets, multiples FPM instances +can be launched without errors). (fat) - Intl . ResourceBundle constructor now accepts NULL for the first two arguments. diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index cb4897e..d24dccc 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -179,6 +179,10 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, flags, sizeof(flags)); if (wp-listen_address_domain == FPM_AF_UNIX) { + if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) { + zlog(ZLOG_ERROR, An another FPM instance seems to already listen on %s, ((struct sockaddr_un *) sa)-sun_path); + return -1; + } unlink( ((struct sockaddr_un *) sa)-sun_path); saved_umask = umask(0777 ^ wp-socket_mode); } @@ -450,3 +454,24 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq) } #endif + +int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */ +{ + int fd; + + if (!sun || sun-sun_family != AF_UNIX) { + return -1; + } + + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) 0) { + return -1; + } + + if (connect(fd, (struct sockaddr *)sun, socklen) == -1) { + return -1; + } + + close(fd); + return 0; +} +/* }}} */ diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 447fbff..b7ff0b2 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -22,6 +22,7 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *addr); int fpm_sockets_init_main(); int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq); +int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen); static inline int fd_set_blocked(int fd, int blocked) /* {{{ */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors): NEWS sapi/fpm/fpm/fpm_sockets.c sapi/fpm/fpm/fpm_sockets.h
Commit:a7761262f70d660cd20ec698c453b8daa922f422 Author:Jerome Loyet f...@php.net Fri, 25 May 2012 21:21:44 +0200 Parents: bf9120ecae6e4653dbb5a1b0576f0b163afd6846 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a7761262f70d660cd20ec698c453b8daa922f422 Log: - Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors) Bugs: https://bugs.php.net/62153 Changed paths: M NEWS M sapi/fpm/fpm/fpm_sockets.c M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/NEWS b/NEWS index bb6a36e..60991b6 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,8 @@ PHP NEWS . Fixed bug #61026 (FPM pools can listen on the same address). (fat) . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). (fat) + . Fixed bug #62153 (when using unix sockets, multiples FPM instances +can be launched without errors). (fat) - Intl: . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index cb4897e..d24dccc 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -179,6 +179,10 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, flags, sizeof(flags)); if (wp-listen_address_domain == FPM_AF_UNIX) { + if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) { + zlog(ZLOG_ERROR, An another FPM instance seems to already listen on %s, ((struct sockaddr_un *) sa)-sun_path); + return -1; + } unlink( ((struct sockaddr_un *) sa)-sun_path); saved_umask = umask(0777 ^ wp-socket_mode); } @@ -450,3 +454,24 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq) } #endif + +int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */ +{ + int fd; + + if (!sun || sun-sun_family != AF_UNIX) { + return -1; + } + + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) 0) { + return -1; + } + + if (connect(fd, (struct sockaddr *)sun, socklen) == -1) { + return -1; + } + + close(fd); + return 0; +} +/* }}} */ diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 447fbff..b7ff0b2 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -22,6 +22,7 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *addr); int fpm_sockets_init_main(); int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq); +int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen); static inline int fd_set_blocked(int fd, int blocked) /* {{{ */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors): sapi/fpm/fpm/fpm_sockets.c sapi/fpm/fpm/fpm_sockets.h
Commit:eeba67914ebe02de279f0188be739b78c7a76958 Author:Jerome Loyet f...@php.net Fri, 25 May 2012 21:23:39 +0200 Parents: a28fe034f2d5253e0fbefafc6a7938df9db7319e Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=eeba67914ebe02de279f0188be739b78c7a76958 Log: - Fixed bug #62153 (when using unix sockets, multiples FPM instances can be launched without errors) Bugs: https://bugs.php.net/62153 Changed paths: M sapi/fpm/fpm/fpm_sockets.c M sapi/fpm/fpm/fpm_sockets.h Diff: diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index cb4897e..d24dccc 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -179,6 +179,10 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, flags, sizeof(flags)); if (wp-listen_address_domain == FPM_AF_UNIX) { + if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) { + zlog(ZLOG_ERROR, An another FPM instance seems to already listen on %s, ((struct sockaddr_un *) sa)-sun_path); + return -1; + } unlink( ((struct sockaddr_un *) sa)-sun_path); saved_umask = umask(0777 ^ wp-socket_mode); } @@ -450,3 +454,24 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq) } #endif + +int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */ +{ + int fd; + + if (!sun || sun-sun_family != AF_UNIX) { + return -1; + } + + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) 0) { + return -1; + } + + if (connect(fd, (struct sockaddr *)sun, socklen) == -1) { + return -1; + } + + close(fd); + return 0; +} +/* }}} */ diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h index 447fbff..b7ff0b2 100644 --- a/sapi/fpm/fpm/fpm_sockets.h +++ b/sapi/fpm/fpm/fpm_sockets.h @@ -22,6 +22,7 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *addr); int fpm_sockets_init_main(); int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq); +int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen); static inline int fd_set_blocked(int fd, int blocked) /* {{{ */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fix help message for '-R': sapi/fpm/fpm/fpm_main.c
Commit:f4c38016b634fbacd6daab6e43d0cd57d1ec5357 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 10:36:45 +0200 Parents: 629273d11b7b345fc3e175d479e3fc08d4087183 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f4c38016b634fbacd6daab6e43d0cd57d1ec5357 Log: - Fix help message for '-R' Changed paths: M sapi/fpm/fpm/fpm_main.c Diff: diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 4eed539..95a7623 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -937,7 +937,7 @@ 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 - -R, allow-to-run-as-root\n + -R, --allow-to-run-as-root\n Allow pool to run as root (disabled by default)\n, prog, PHP_PREFIX); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - add missing help message for '-R': sapi/fpm/fpm/fpm_main.c
Commit:629273d11b7b345fc3e175d479e3fc08d4087183 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 10:34:16 +0200 Parents: 7b396c078cc8fef18f37cc9a22c437f13921e375 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=629273d11b7b345fc3e175d479e3fc08d4087183 Log: - add missing help message for '-R' Changed paths: M sapi/fpm/fpm/fpm_main.c Diff: diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index e74986f..4eed539 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -936,7 +936,10 @@ static void php_cgi_usage(char *argv0) Specify the PID file location.\n -y, --fpm-config file\n Specify alternative path to FastCGI process manager config file.\n - -t, --test Test FPM configuration and exit\n, + -t, --test Test FPM configuration and exit\n + -R, allow-to-run-as-root\n + Allow pool to run as root (disabled by default)\n, + prog, PHP_PREFIX); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61835 (php-fpm is not allowed to run as root): NEWS sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/fpm_unix.c
Commit:7b396c078cc8fef18f37cc9a22c437f13921e375 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 09:49:13 +0200 Parents: f733173b1f70acec4f124f3c8e9dc1b3fb422413 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7b396c078cc8fef18f37cc9a22c437f13921e375 Log: - Fixed bug #61835 (php-fpm is not allowed to run as root) Bugs: https://bugs.php.net/61835 Changed paths: M NEWS M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/NEWS b/NEWS index d6ac422..c1d5f61 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ PHP NEWS - FPM . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) + . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 96aabbf..909902b 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -37,10 +37,11 @@ struct fpm_globals_s fpm_globals = { .max_requests = 0, .is_child = 0, .test_successful = 0, - .heartbeat = 0 + .heartbeat = 0, + .run_as_root = 0, }; -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */ +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */ { fpm_globals.argc = argc; fpm_globals.argv = argv; @@ -49,6 +50,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t } fpm_globals.prefix = prefix; fpm_globals.pid = pid; + fpm_globals.run_as_root = run_as_root; if (0 fpm_php_init_main() || 0 fpm_stdio_init_main() || diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index bfeac4d..2a69cb2 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -8,7 +8,7 @@ #include unistd.h int fpm_run(int *max_requests); -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf); +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root); struct fpm_globals_s { pid_t parent_pid; @@ -25,6 +25,7 @@ struct fpm_globals_s { int is_child; int test_successful; int heartbeat; + int run_as_root; }; extern struct fpm_globals_s fpm_globals; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 5767971..e74986f 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -154,6 +154,7 @@ static const opt_struct OPTIONS[] = { {'t', 0, test}, {'p', 1, prefix}, {'g', 1, pid}, + {'R', 0, allow-to-run-as-root}, {'-', 0, NULL} /* end of args */ }; @@ -1557,6 +1558,7 @@ int main(int argc, char *argv[]) char *fpm_pid = NULL; int test_conf = 0; int php_information = 0; + int php_allow_to_run_as_root = 0; fcgi_init(); @@ -1670,6 +1672,10 @@ int main(int argc, char *argv[]) php_information = 1; break; + case 'R': /* allow to run as root */ + php_allow_to_run_as_root = 1; + break; + default: case 'h': case '?': @@ -1793,7 +1799,7 @@ 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)) { + 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)) { return FAILURE; } diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 17d0b81..fb61d63 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -112,12 +112,12 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */ } } -#ifndef I_REALLY_WANT_ROOT_PHP - if (wp-set_uid == 0 || wp-set_gid == 0) { - zlog(ZLOG_ERROR, [pool %s] please specify user and group other than root, wp-config-name); - return -1; + if (!fpm_globals.run_as_root) { + if (wp-set_uid == 0 || wp-set_gid == 0) { + zlog(ZLOG_ERROR, [pool %s] please specify user and group other than root, wp-config-name); + return -1; + } } -#endif } else { /* not root */ if (wp-config-user *wp-config-user) { zlog(ZLOG_WARNING, [pool %s]
[PHP-CVS] com php-src: - fix help message for '-R': sapi/fpm/fpm/fpm_main.c
Commit:757e3fc3d5ca6d175c829549f256adc98b7c1f46 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 10:35:37 +0200 Parents: 06c7c3674b5e205023de7a150d29d78c313143f8 Branches: PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=757e3fc3d5ca6d175c829549f256adc98b7c1f46 Log: - fix help message for '-R' Changed paths: M sapi/fpm/fpm/fpm_main.c Diff: diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index dd48ffd..130673f 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -927,8 +927,8 @@ static void php_cgi_usage(char *argv0) Specify the PID file location.\n -y, --fpm-config file\n Specify alternative path to FastCGI process manager config file.\n - -t, --test Test FPM configuration and exit\n, - -R, allow-to-run-as-root\n + -t, --test Test FPM configuration and exit\n + -R, --allow-to-run-as-root\n Allow pool to run as root (disabled by default)\n, prog, PHP_PREFIX); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61835 (php-fpm is not allowed to run as root): NEWS sapi/fpm/fpm/fpm.c sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/fpm_unix.c
Commit:06c7c3674b5e205023de7a150d29d78c313143f8 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 10:32:42 +0200 Parents: 8475c5b98d6a2edfd520261b72f636451cd3c95d Branches: PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=06c7c3674b5e205023de7a150d29d78c313143f8 Log: - Fixed bug #61835 (php-fpm is not allowed to run as root) Bugs: https://bugs.php.net/61835 Changed paths: M NEWS M sapi/fpm/fpm/fpm.c M sapi/fpm/fpm/fpm.h M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/fpm_unix.c Diff: diff --git a/NEWS b/NEWS index ad51a67..ff80183 100644 --- a/NEWS +++ b/NEWS @@ -56,6 +56,7 @@ PHP NEWS - FPM . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) + . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) - Libxml: . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 96aabbf..909902b 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -37,10 +37,11 @@ struct fpm_globals_s fpm_globals = { .max_requests = 0, .is_child = 0, .test_successful = 0, - .heartbeat = 0 + .heartbeat = 0, + .run_as_root = 0, }; -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */ +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */ { fpm_globals.argc = argc; fpm_globals.argv = argv; @@ -49,6 +50,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t } fpm_globals.prefix = prefix; fpm_globals.pid = pid; + fpm_globals.run_as_root = run_as_root; if (0 fpm_php_init_main() || 0 fpm_stdio_init_main() || diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index bfeac4d..2a69cb2 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -8,7 +8,7 @@ #include unistd.h int fpm_run(int *max_requests); -int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf); +int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root); struct fpm_globals_s { pid_t parent_pid; @@ -25,6 +25,7 @@ struct fpm_globals_s { int is_child; int test_successful; int heartbeat; + int run_as_root; }; extern struct fpm_globals_s fpm_globals; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index a28af53..dd48ffd 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -154,6 +154,7 @@ static const opt_struct OPTIONS[] = { {'t', 0, test}, {'p', 1, prefix}, {'g', 1, pid}, + {'R', 0, allow-to-run-as-root}, {'-', 0, NULL} /* end of args */ }; @@ -927,6 +928,8 @@ 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, + -R, allow-to-run-as-root\n + Allow pool to run as root (disabled by default)\n, prog, PHP_PREFIX); } /* }}} */ @@ -1548,6 +1551,7 @@ int main(int argc, char *argv[]) char *fpm_pid = NULL; int test_conf = 0; int php_information = 0; + int php_allow_to_run_as_root = 0; #ifdef HAVE_SIGNAL_H #if defined(SIGPIPE) defined(SIG_IGN) @@ -1662,6 +1666,10 @@ int main(int argc, char *argv[]) php_information = 1; break; + case 'R': /* allow to run as root */ + php_allow_to_run_as_root = 1; + break; + default: case 'h': case '?': @@ -1789,7 +1797,7 @@ 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)) { + 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)) { return FAILURE; } diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 17d0b81..fb61d63 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -112,12 +112,12 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */ } } -#ifndef I_REALLY_WANT_ROOT_PHP - if (wp-set_uid == 0 || wp-set_gid == 0) { -
[PHP-CVS] com php-src: - Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start): NEWS sapi/fpm/fpm/fpm_conf.c
Commit:812d2481935185eeeabb2c1fe2d7eafd76fc7359 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 11:30:27 +0200 Parents: f4c38016b634fbacd6daab6e43d0cd57d1ec5357 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=812d2481935185eeeabb2c1fe2d7eafd76fc7359 Log: - Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start) Bugs: https://bugs.php.net/61295 Changed paths: M NEWS M sapi/fpm/fpm/fpm_conf.c Diff: diff --git a/NEWS b/NEWS index c1d5f61..13ac964 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ PHP NEWS - FPM . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) + . Fixed bug #61295 (php-fpm should not fail with commented 'user' +for non-root start). (fat) - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 304076d..0b2c5ae 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -723,8 +723,8 @@ static int fpm_conf_process_all_pools() /* {{{ */ } } - /* user */ - if (!wp-config-user) { + /* alert if user is not set only if we are not root*/ + if (!wp-config-user !geteuid()) { zlog(ZLOG_ALERT, [pool %s] user has not been defined, wp-config-name); return -1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start): NEWS sapi/fpm/fpm/fpm_conf.c
Commit:a07d76c0ba57e6471ac5869af0aaa26206baa284 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 11:31:33 +0200 Parents: 757e3fc3d5ca6d175c829549f256adc98b7c1f46 Branches: PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a07d76c0ba57e6471ac5869af0aaa26206baa284 Log: - Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start) Bugs: https://bugs.php.net/61295 Changed paths: M NEWS M sapi/fpm/fpm/fpm_conf.c Diff: diff --git a/NEWS b/NEWS index ff80183..c8aa208 100644 --- a/NEWS +++ b/NEWS @@ -57,6 +57,8 @@ PHP NEWS - FPM . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) + . Fixed bug #61295 (php-fpm should not fail with commented 'user' +for non-root start). (fat) - Libxml: . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 304076d..0b2c5ae 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -723,8 +723,8 @@ static int fpm_conf_process_all_pools() /* {{{ */ } } - /* user */ - if (!wp-config-user) { + /* alert if user is not set only if we are not root*/ + if (!wp-config-user !geteuid()) { zlog(ZLOG_ALERT, [pool %s] user has not been defined, wp-config-name); return -1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm): NEWS sapi/fpm/config.m4
Commit:0b44f16ea2f18a08eb1249db6621840527eab5e0 Author:Jerome Loyet f...@php.net Wed, 23 May 2012 11:40:22 +0200 Parents: a07d76c0ba57e6471ac5869af0aaa26206baa284 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0b44f16ea2f18a08eb1249db6621840527eab5e0 Log: - Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm) Bugs: https://bugs.php.net/61839 Changed paths: M NEWS M sapi/fpm/config.m4 Diff: diff --git a/NEWS b/NEWS index c8aa208..9b0a3ac 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,7 @@ PHP NEWS . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) . Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start). (fat) + . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) - Libxml: . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 8962810..6c860c9 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -192,6 +192,8 @@ AC_DEFUN([AC_FPM_TRACE], have_ptrace=no have_broken_ptrace=yes AC_MSG_RESULT([no]) +], [ + AC_MSG_RESULT([skipped (cross compiling)]) ]) fi @@ -264,6 +266,8 @@ AC_DEFUN([AC_FPM_TRACE], ], [ proc_mem_file= AC_MSG_RESULT([no]) +], [ + AC_MSG_RESULT([skipped (cross compiling)]) ]) fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61026 (FPM pools can listen on the same address): NEWS sapi/fpm/fpm/fpm_conf.c
Commit:5d61e56dd7e19b82abde23f83b203449a48cc91a Author:Jerome Loyet f...@php.net Wed, 23 May 2012 11:52:04 +0200 Parents: 812d2481935185eeeabb2c1fe2d7eafd76fc7359 Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5d61e56dd7e19b82abde23f83b203449a48cc91a Log: - Fixed bug #61026 (FPM pools can listen on the same address) Bugs: https://bugs.php.net/61026 Changed paths: M NEWS M sapi/fpm/fpm/fpm_conf.c Diff: diff --git a/NEWS b/NEWS index 13ac964..7542724 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ PHP NEWS . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) . Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start). (fat) + . Fixed bug #61026 (FPM pools can listen on the same address). (fat) - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 0b2c5ae..a4283a2 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -704,7 +704,7 @@ static int fpm_evaluate_full_path(char **path, struct fpm_worker_pool_s *wp, cha static int fpm_conf_process_all_pools() /* {{{ */ { - struct fpm_worker_pool_s *wp; + struct fpm_worker_pool_s *wp, *wp2; if (!fpm_worker_all_pools) { zlog(ZLOG_ERROR, No pool defined. at least one pool section must be specified in config file); @@ -1044,6 +1044,20 @@ static int fpm_conf_process_all_pools() /* {{{ */ } } } + + /* ensure 2 pools do not use the same listening address */ + for (wp = fpm_worker_all_pools; wp; wp = wp-next) { + for (wp2 = fpm_worker_all_pools; wp2; wp2 = wp2-next) { + if (wp == wp2) { + continue; + } + + if (wp-config-listen_address *wp-config-listen_address wp2-config-listen_address *wp2-config-listen_address !strcmp(wp-config-listen_address, wp2-config-listen_address)) { + zlog(ZLOG_ERROR, [pool %s] unable to set listen address as it's already used in another pool '%s', wp2-config-name, wp-config-name); + return -1; + } + } + } return 0; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61026 (FPM pools can listen on the same address): NEWS sapi/fpm/fpm/fpm_conf.c
Commit:1299503936597ea873a3eb8272aa4deec2f31e5b Author:Jerome Loyet f...@php.net Wed, 23 May 2012 11:53:04 +0200 Parents: d236c1af8a5e1813e2667de969fa2ad39da74887 Branches: PHP-5.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1299503936597ea873a3eb8272aa4deec2f31e5b Log: - Fixed bug #61026 (FPM pools can listen on the same address) Bugs: https://bugs.php.net/61026 Changed paths: M NEWS M sapi/fpm/fpm/fpm_conf.c Diff: diff --git a/NEWS b/NEWS index 9b0a3ac..1db032a 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,7 @@ PHP NEWS . Fixed bug #61295 (php-fpm should not fail with commented 'user' for non-root start). (fat) . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) + . Fixed bug #61026 (FPM pools can listen on the same address). (fat) - Libxml: . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 0b2c5ae..a4283a2 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -704,7 +704,7 @@ static int fpm_evaluate_full_path(char **path, struct fpm_worker_pool_s *wp, cha static int fpm_conf_process_all_pools() /* {{{ */ { - struct fpm_worker_pool_s *wp; + struct fpm_worker_pool_s *wp, *wp2; if (!fpm_worker_all_pools) { zlog(ZLOG_ERROR, No pool defined. at least one pool section must be specified in config file); @@ -1044,6 +1044,20 @@ static int fpm_conf_process_all_pools() /* {{{ */ } } } + + /* ensure 2 pools do not use the same listening address */ + for (wp = fpm_worker_all_pools; wp; wp = wp-next) { + for (wp2 = fpm_worker_all_pools; wp2; wp2 = wp2-next) { + if (wp == wp2) { + continue; + } + + if (wp-config-listen_address *wp-config-listen_address wp2-config-listen_address *wp2-config-listen_address !strcmp(wp-config-listen_address, wp2-config-listen_address)) { + zlog(ZLOG_ERROR, [pool %s] unable to set listen address as it's already used in another pool '%s', wp2-config-name, wp-config-name); + return -1; + } + } + } return 0; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61045 (fpm don't send error log to fastcgi clients): NEWS sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/zlog.c sapi/fpm/fpm/zlog.h
Commit:faca4e08b4dffbf00b1bc20fc5d4e310b3f99c13 Author:Jerome Loyet f...@php.net Tue, 22 May 2012 08:34:27 +0200 Parents: c973fef48d6302b9bcec898de8e39d8d7e23adef Branches: PHP-5.3 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=faca4e08b4dffbf00b1bc20fc5d4e310b3f99c13 Log: - Fixed bug #61045 (fpm don't send error log to fastcgi clients) Bugs: https://bugs.php.net/61045 Changed paths: M NEWS M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/zlog.c M sapi/fpm/fpm/zlog.h Diff: diff --git a/NEWS b/NEWS index 5f1146a..d6ac422 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ PHP NEWS ?? ??? 2012, PHP 5.3.14 +- FPM + . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) + - XML Writer: . Fixed bug #62064 (memory leak in the XML Writer module). (jean-pierre dot lozi at lip6 dot fr) diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 1ebeefa..5767971 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -655,14 +655,38 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) } } -static void sapi_cgi_log_message(char *message) +/* {{{ sapi_cgi_log_fastcgi + * + * Ignore level, we want to send all messages through fastcgi + */ +void sapi_cgi_log_fastcgi(int level, char *message, size_t len) { TSRMLS_FETCH(); - if (CGIG(fcgi_logging)) { - zlog(ZLOG_NOTICE, PHP message: %s, message); + fcgi_request *request = (fcgi_request*) SG(server_context); + + /* ensure we want: +* - to log (fastcgi.logging in php.ini) +* - we are currently dealing with a request +* - the message is not empty +*/ + if (CGIG(fcgi_logging) request message len 0) { + char *buf = malloc(len + 2); + memcpy(buf, message, len); + memcpy(buf + len, \n, sizeof(\n)); + fcgi_write(request, FCGI_STDERR, buf, len+1); + free(buf); } } +/* }}} */ + +/* {{{ sapi_cgi_log_message + */ +static void sapi_cgi_log_message(char *message) +{ + zlog(ZLOG_NOTICE, PHP message: %s, message); +} +/* }}} */ /* {{{ php_cgi_ini_activate_user_config */ @@ -1778,6 +1802,9 @@ consult the installation file that came with this distribution, or visit \n\ fcgi_fd = fpm_run(max_requests); parent = 0; + /* onced forked tell zlog to also send messages through sapi_cgi_log_fastcgi() */ + zlog_set_external_logger(sapi_cgi_log_fastcgi); + /* make php call us to get _ENV vars */ php_php_import_environment_variables = php_import_environment_variables; php_import_environment_variables = cgi_php_import_environment_variables; diff --git a/sapi/fpm/fpm/zlog.c b/sapi/fpm/fpm/zlog.c index b127ec1..80db9d8 100644 --- a/sapi/fpm/fpm/zlog.c +++ b/sapi/fpm/fpm/zlog.c @@ -22,6 +22,7 @@ static int zlog_fd = -1; static int zlog_level = ZLOG_NOTICE; static int launched = 0; +static void (*external_logger)(int, char *, size_t) = NULL; static const char *level_names[] = { [ZLOG_DEBUG] = DEBUG, @@ -41,6 +42,12 @@ const int syslog_priorities[] = { }; #endif +void zlog_set_external_logger(void (*logger)(int, char *, size_t)) /* {{{ */ +{ + external_logger = logger; +} +/* }}} */ + const char *zlog_get_level_name(int log_level) /* {{{ */ { if (log_level 0) { @@ -101,6 +108,19 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* int truncated = 0; int saved_errno; + if (external_logger) { + va_start(args, fmt); + len = vsnprintf(buf, buf_size, fmt, args); + va_end(args); + if (len = buf_size) { + memcpy(buf + buf_size - sizeof(...), ..., sizeof(...) - 1); + len = buf_size - 1; + } + external_logger(flags ZLOG_LEVEL_MASK, buf, len); + len = 0; + memset(buf, '\0', buf_size); + } + if ((flags ZLOG_LEVEL_MASK) zlog_level) { return; } diff --git a/sapi/fpm/fpm/zlog.h b/sapi/fpm/fpm/zlog.h index e6a5c01..1945922 100644 --- a/sapi/fpm/fpm/zlog.h +++ b/sapi/fpm/fpm/zlog.h @@ -9,6 +9,7 @@ struct timeval; +void zlog_set_external_logger(void (*logger)(int, char *, size_t)); int zlog_set_fd(int new_fd); int zlog_set_level(int new_value); const char *zlog_get_level_name(int log_level); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - Fixed bug #61045 (fpm don't send error log to fastcgi clients): NEWS sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/zlog.c sapi/fpm/fpm/zlog.h
Commit:dce259099df6505bb82b63700e4d14832b74e8c1 Author:Jerome Loyet f...@php.net Tue, 22 May 2012 08:40:37 +0200 Parents: d1e529c1cba17bed376833ab0a4c785a251abf02 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dce259099df6505bb82b63700e4d14832b74e8c1 Log: - Fixed bug #61045 (fpm don't send error log to fastcgi clients) Bugs: https://bugs.php.net/61045 Changed paths: M NEWS M sapi/fpm/fpm/fpm_main.c M sapi/fpm/fpm/zlog.c M sapi/fpm/fpm/zlog.h Diff: diff --git a/NEWS b/NEWS index dd31dde..ba0b220 100644 --- a/NEWS +++ b/NEWS @@ -54,10 +54,13 @@ PHP NEWS . Implemented FR #61602 (Allow access to the name of constant used as function/method parameter's default value). (reeze@gmail.com) -- FPM +- Fileinfo . Fixed bug #61812 (Uninitialised value used in libmagic). (Laruence, Gustavo) +- FPM + . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) + - Libxml: . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). (Laruence) diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 14dccbd..a28af53 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -646,12 +646,38 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) } } -static void sapi_cgi_log_message(char *message TSRMLS_DC) +/* {{{ sapi_cgi_log_fastcgi + * + * Ignore level, we want to send all messages through fastcgi + */ +void sapi_cgi_log_fastcgi(int level, char *message, size_t len) { - if (CGIG(fcgi_logging)) { - zlog(ZLOG_NOTICE, PHP message: %s, message); + TSRMLS_FETCH(); + + fcgi_request *request = (fcgi_request*) SG(server_context); + + /* ensure we want: +* - to log (fastcgi.logging in php.ini) +* - we are currently dealing with a request +* - the message is not empty +*/ + if (CGIG(fcgi_logging) request message len 0) { + char *buf = malloc(len + 2); + memcpy(buf, message, len); + memcpy(buf + len, \n, sizeof(\n)); + fcgi_write(request, FCGI_STDERR, buf, len+1); + free(buf); } } +/* }}} */ + +/* {{{ sapi_cgi_log_message + */ +static void sapi_cgi_log_message(char *message) +{ + zlog(ZLOG_NOTICE, PHP message: %s, message); +} +/* }}} */ /* {{{ php_cgi_ini_activate_user_config */ @@ -1772,6 +1798,9 @@ consult the installation file that came with this distribution, or visit \n\ fcgi_fd = fpm_run(max_requests); parent = 0; + /* onced forked tell zlog to also send messages through sapi_cgi_log_fastcgi() */ + zlog_set_external_logger(sapi_cgi_log_fastcgi); + /* make php call us to get _ENV vars */ php_php_import_environment_variables = php_import_environment_variables; php_import_environment_variables = cgi_php_import_environment_variables; diff --git a/sapi/fpm/fpm/zlog.c b/sapi/fpm/fpm/zlog.c index b127ec1..80db9d8 100644 --- a/sapi/fpm/fpm/zlog.c +++ b/sapi/fpm/fpm/zlog.c @@ -22,6 +22,7 @@ static int zlog_fd = -1; static int zlog_level = ZLOG_NOTICE; static int launched = 0; +static void (*external_logger)(int, char *, size_t) = NULL; static const char *level_names[] = { [ZLOG_DEBUG] = DEBUG, @@ -41,6 +42,12 @@ const int syslog_priorities[] = { }; #endif +void zlog_set_external_logger(void (*logger)(int, char *, size_t)) /* {{{ */ +{ + external_logger = logger; +} +/* }}} */ + const char *zlog_get_level_name(int log_level) /* {{{ */ { if (log_level 0) { @@ -101,6 +108,19 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* int truncated = 0; int saved_errno; + if (external_logger) { + va_start(args, fmt); + len = vsnprintf(buf, buf_size, fmt, args); + va_end(args); + if (len = buf_size) { + memcpy(buf + buf_size - sizeof(...), ..., sizeof(...) - 1); + len = buf_size - 1; + } + external_logger(flags ZLOG_LEVEL_MASK, buf, len); + len = 0; + memset(buf, '\0', buf_size); + } + if ((flags ZLOG_LEVEL_MASK) zlog_level) { return; } diff --git a/sapi/fpm/fpm/zlog.h b/sapi/fpm/fpm/zlog.h index e6a5c01..1945922 100644 --- a/sapi/fpm/fpm/zlog.h +++ b/sapi/fpm/fpm/zlog.h @@ -9,6 +9,7 @@ struct timeval; +void zlog_set_external_logger(void (*logger)(int, char *, size_t)); int zlog_set_fd(int new_fd); int zlog_set_level(int new_value); const char *zlog_get_level_name(int log_level); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: - fix NEWS for bug #61812: NEWS
Commit:d1e529c1cba17bed376833ab0a4c785a251abf02 Author:Jerome Loyet f...@php.net Tue, 22 May 2012 08:38:09 +0200 Parents: 074d361d647b0fba334e5e14d3b6904ba1ea09d8 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d1e529c1cba17bed376833ab0a4c785a251abf02 Log: - fix NEWS for bug #61812 Bugs: https://bugs.php.net/61812 Changed paths: M NEWS Diff: diff --git a/NEWS b/NEWS index 68f0a35..dd31dde 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,9 @@ PHP NEWS - Phar: . Fix bug #61065 (Secunia SA44335). (Rasmus) +- Pgsql: + . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) + - Reflection: . Implemented FR #61602 (Allow access to the name of constant used as function/method parameter's default value). (reeze@gmail.com) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] com php-src: - fix NEWS for bug #61812: NEWS
gnurf ? wtf ? I'm sorry guys for this NEWS modification on master. It was not supposed to be. I hate GIT ... it was so much clear and easy with SVN. I'll try to fix this but not sure to know how to ... ++ fat 2012/5/22 Jérôme Loyet f...@php.net Commit:d1e529c1cba17bed376833ab0a4c785a251abf02 Author:Jerome Loyet f...@php.net Tue, 22 May 2012 08:38:09 +0200 Parents: 074d361d647b0fba334e5e14d3b6904ba1ea09d8 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d1e529c1cba17bed376833ab0a4c785a251abf02 Log: - fix NEWS for bug #61812 Bugs: https://bugs.php.net/61812 Changed paths: M NEWS Diff: diff --git a/NEWS b/NEWS index 68f0a35..dd31dde 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,9 @@ PHP NEWS - Phar: . Fix bug #61065 (Secunia SA44335). (Rasmus) +- Pgsql: + . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) + - Reflection: . Implemented FR #61602 (Allow access to the name of constant used as function/method parameter's default value). ( reeze@gmail.com) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] com php-src: - fix NEWS for bug #61812: NEWS
I really don't know what this is I made a patch for 5.3 (sources + NEWS) with a commit I made a patch for 5.4 (sources + NEWS) with a commit (I did not use merge, it was 2 distinct commits) I merge 5.4 into master I push to origin I've followed the git faq on the wiki (the config are all set correctly) and now I don't understand why there is a modification of NEWS on master while this file is not supposed to be merged between branches. Is it just an impression of GIT is just over complicated ? god I miss svn :/ So if my commits are wrong, feel free to fix because I don't even know if there's a problem or if it's all OK thx ++ fat 2012/5/22 Jérôme Loyet f...@php.net gnurf ? wtf ? I'm sorry guys for this NEWS modification on master. It was not supposed to be. I hate GIT ... it was so much clear and easy with SVN. I'll try to fix this but not sure to know how to ... ++ fat 2012/5/22 Jérôme Loyet f...@php.net Commit:d1e529c1cba17bed376833ab0a4c785a251abf02 Author:Jerome Loyet f...@php.net Tue, 22 May 2012 08:38:09 +0200 Parents: 074d361d647b0fba334e5e14d3b6904ba1ea09d8 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d1e529c1cba17bed376833ab0a4c785a251abf02 Log: - fix NEWS for bug #61812 Bugs: https://bugs.php.net/61812 Changed paths: M NEWS Diff: diff --git a/NEWS b/NEWS index 68f0a35..dd31dde 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,9 @@ PHP NEWS - Phar: . Fix bug #61065 (Secunia SA44335). (Rasmus) +- Pgsql: + . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) + - Reflection: . Implemented FR #61602 (Allow access to the name of constant used as function/method parameter's default value). ( reeze@gmail.com) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c branches/PHP_5_4/NEWS branches/PHP_5_4/sapi/fpm/fpm/fpm_request.c trunk/sapi/fpm/fpm/fpm_request.c
fat Wed, 04 Jan 2012 21:18:26 + Revision: http://svn.php.net/viewvc?view=revisionrevision=321770 Log: - Fixed bug #60659 (FPM does not clear auth_user on request accept) Bug: https://bugs.php.net/60659 (Open) FPM does not clear auth_user on request accept Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_request.c U php/php-src/trunk/sapi/fpm/fpm/fpm_request.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2012-01-04 20:40:13 UTC (rev 321769) +++ php/php-src/branches/PHP_5_3/NEWS 2012-01-04 21:18:26 UTC (rev 321770) @@ -22,6 +22,7 @@ - PHP-FPM SAPI: . Fixed bug #60629 (memory corruption when web server closed the fcgi fd). (fat) + . Fixed bug #60659 (FPM does not clear auth_user on request accept). (fat) 08 Dec 2011, PHP 5.3.9RC3 Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c 2012-01-04 20:40:13 UTC (rev 321769) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c 2012-01-04 21:18:26 UTC (rev 321770) @@ -92,6 +92,8 @@ proc-request_method[0] = '\0'; proc-script_filename[0] = '\0'; proc-query_string[0] = '\0'; + proc-query_string[0] = '\0'; + proc-auth_user[0] = '\0'; proc-content_length = 0; fpm_scoreboard_proc_release(proc); Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2012-01-04 20:40:13 UTC (rev 321769) +++ php/php-src/branches/PHP_5_4/NEWS 2012-01-04 21:18:26 UTC (rev 321770) @@ -23,6 +23,7 @@ - PHP-FPM SAPI: . Fixed bug #60629 (memory corruption when web server closed the fcgi fd). (fat) + . Fixed bug #60659 (FPM does not clear auth_user on request accept). (fat) - Improved Session extension: . Fixed bug #60640 (invalid return values). (Arpad) Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_request.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_request.c 2012-01-04 20:40:13 UTC (rev 321769) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_request.c 2012-01-04 21:18:26 UTC (rev 321770) @@ -92,6 +92,8 @@ proc-request_method[0] = '\0'; proc-script_filename[0] = '\0'; proc-query_string[0] = '\0'; + proc-query_string[0] = '\0'; + proc-auth_user[0] = '\0'; proc-content_length = 0; fpm_scoreboard_proc_release(proc); Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_request.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_request.c2012-01-04 20:40:13 UTC (rev 321769) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_request.c2012-01-04 21:18:26 UTC (rev 321770) @@ -92,6 +92,8 @@ proc-request_method[0] = '\0'; proc-script_filename[0] = '\0'; proc-query_string[0] = '\0'; + proc-query_string[0] = '\0'; + proc-auth_user[0] = '\0'; proc-content_length = 0; fpm_scoreboard_proc_release(proc); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/ PHP_5_3/NEWS PHP_5_4/NEWS
fat Wed, 04 Jan 2012 21:19:55 + Revision: http://svn.php.net/viewvc?view=revisionrevision=321771 Log: - Fixed credits for bug #60659 Bug: https://bugs.php.net/60659 (Open) FPM does not clear auth_user on request accept Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_4/NEWS Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2012-01-04 21:18:26 UTC (rev 321770) +++ php/php-src/branches/PHP_5_3/NEWS 2012-01-04 21:19:55 UTC (rev 321771) @@ -22,7 +22,8 @@ - PHP-FPM SAPI: . Fixed bug #60629 (memory corruption when web server closed the fcgi fd). (fat) - . Fixed bug #60659 (FPM does not clear auth_user on request accept). (fat) + . Fixed bug #60659 (FPM does not clear auth_user on request accept). +(bonbons at linux-vserver dot org) 08 Dec 2011, PHP 5.3.9RC3 Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2012-01-04 21:18:26 UTC (rev 321770) +++ php/php-src/branches/PHP_5_4/NEWS 2012-01-04 21:19:55 UTC (rev 321771) @@ -23,7 +23,8 @@ - PHP-FPM SAPI: . Fixed bug #60629 (memory corruption when web server closed the fcgi fd). (fat) - . Fixed bug #60659 (FPM does not clear auth_user on request accept). (fat) + . Fixed bug #60659 (FPM does not clear auth_user on request accept). +(bonbons at linux-vserver dot org) - Improved Session extension: . Fixed bug #60640 (invalid return values). (Arpad) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c branches/PHP_5_4/NEWS branch
fat Tue, 03 Jan 2012 22:26:11 + Revision: http://svn.php.net/viewvc?view=revisionrevision=321734 Log: - Fixed bug #60629 (memory corruption when web server closed the fcgi fd) Bug: https://bugs.php.net/60629 (Feedback) memory corruption when web server closed the fcgi fd(?) Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.h U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fastcgi.c U php/php-src/trunk/sapi/fpm/fpm/fastcgi.h U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2012-01-03 21:47:16 UTC (rev 321733) +++ php/php-src/branches/PHP_5_3/NEWS 2012-01-03 22:26:11 UTC (rev 321734) @@ -19,7 +19,11 @@ . Fixed bug #48877 (bindValue and bindParam do not work for PDO Firebird). (Mariuz) +- PHP-FPM SAPI: + . Fixed bug #60629 (memory corruption when web server closed the fcgi fd). +(fat) + 08 Dec 2011, PHP 5.3.9RC3 - Filter: Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2012-01-03 21:47:16 UTC (rev 321733) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2012-01-03 22:26:11 UTC (rev 321734) @@ -946,7 +946,7 @@ return 1; } -int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len) +ssize_t fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len) { int limit, rest; Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h 2012-01-03 21:47:16 UTC (rev 321733) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h 2012-01-03 22:26:11 UTC (rev 321734) @@ -127,7 +127,7 @@ int fcgi_read(fcgi_request *req, char *str, int len); -int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len); +ssize_t fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len); int fcgi_flush(fcgi_request *req, int close); void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len); Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2012-01-03 21:47:16 UTC (rev 321733) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2012-01-03 22:26:11 UTC (rev 321734) @@ -268,7 +268,7 @@ static inline size_t sapi_cgibin_single_write(const char *str, uint str_length TSRMLS_DC) { - size_t ret; + ssize_t ret; /* sapi has started which means everyhting must be send through fcgi */ if (fpm_is_running) { @@ -277,7 +277,7 @@ if (ret = 0) { return 0; } - return ret; + return (size_t)ret; } /* sapi has not started, output to stdout instead of fcgi */ @@ -286,7 +286,7 @@ if (ret = 0) { return 0; } - return ret; + return (size_t)ret; #else return fwrite(str, 1, MIN(str_length, 16384), stdout); #endif Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2012-01-03 21:47:16 UTC (rev 321733) +++ php/php-src/branches/PHP_5_4/NEWS 2012-01-03 22:26:11 UTC (rev 321734) @@ -18,7 +18,11 @@ - Intl: . Fixed build on Fedora 15 / Ubuntu 11. (Hannes) +- PHP-FPM SAPI: + . Fixed bug #60629 (memory corruption when web server closed the fcgi fd). +(fat) + 22 Dec 2011, PHP 5.4.0 RC4 - Core: . Added max_input_vars directive to prevent attacks based on hash collisions Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c 2012-01-03 21:47:16 UTC (rev 321733) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c 2012-01-03 22:26:11 UTC (rev 321734) @@ -946,7 +946,7 @@ return 1; } -int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len) +ssize_t fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len) { int limit, rest; Modified:
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c branches/PHP_5_4/NEWS branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c trunk/sapi/fpm/fpm/fpm_main.c
fat Tue, 15 Nov 2011 22:29:59 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319281 Log: - FR #60199 (enhance FPM error log when the primary script can't be open) Bug: https://bugs.php.net/60199 (Feedback) php-fpm does not log an error for too many open files Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_3/NEWS 2011-11-15 22:29:59 UTC (rev 319281) @@ -10,6 +10,7 @@ - PHP-FPM SAPI: . Fixed bug #60179 (php_flag and php_value does not work properly). (fat) + . enhance error log when the primary script can't be open. FR #60199. (fat) - Intl: . Fixed bug #60192 (SegFault when Collator not constructed Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-11-15 22:29:59 UTC (rev 319281) @@ -1787,6 +1787,7 @@ SG(server_context) = (void *) request; init_request_info(TSRMLS_C); CG(interactive) = 0; + char *primary_script = NULL; fpm_request_info(); @@ -1812,7 +1813,9 @@ /* If path_translated is NULL, terminate here with a 404 */ if (!SG(request_info).path_translated) { zend_try { + zlog(ZLOG_DEBUG, Primary script unknown); SG(sapi_headers).http_response_code = 404; + PUTS(File not found.\n); } zend_catch { } zend_end_try(); goto fastcgi_request_done; @@ -1824,9 +1827,16 @@ goto fastcgi_request_done; } + /* +* have to duplicate SG(request_info).path_translated to be able to log errrors +* php_fopen_primary_script seems to delete SG(request_info).path_translated on failure +*/ + primary_script = estrdup(SG(request_info).path_translated); + /* path_translated exists, we can continue ! */ if (php_fopen_primary_script(file_handle TSRMLS_CC) == FAILURE) { zend_try { + zlog(ZLOG_ERROR, Unable to open primary script: %s (%s), primary_script, strerror(errno)); if (errno == EACCES) { SG(sapi_headers).http_response_code = 403; PUTS(Access denied.\n); @@ -1848,6 +1858,10 @@ php_execute_script(file_handle TSRMLS_CC); fastcgi_request_done: + if (primary_script) { + efree(primary_script); + } + if (request_body_fd != -1) { close(request_body_fd); } Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_4/NEWS 2011-11-15 22:29:59 UTC (rev 319281) @@ -32,6 +32,10 @@ resource). (Laruence) . Fixed bug #55759 (memory leak when using built-in server). (Laruence) +- Improved PHP-FPM SAPI: + . enhance error log when the primary script can't be open. FR #60199. (fat) + + 11 Nov 2011, PHP 5.4.0 RC1 - General improvements: . Changed silent conversion of array to string to produce a notice. (Patrick) Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-11-15 22:29:59 UTC (rev 319281) @@ -1785,6 +1785,7 @@ SG(server_context) = (void *) request; init_request_info(TSRMLS_C); CG(interactive) = 0; + char *primary_script = NULL;
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/NEWS branches/PHP_5_4/sapi/fpm/config.m4 trunk/sapi/fpm/config.m4
fat Tue, 15 Nov 2011 22:40:10 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319282 Log: - remove experimental flag on fpm Changed paths: U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 U php/php-src/trunk/sapi/fpm/config.m4 Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-11-15 22:29:59 UTC (rev 319281) +++ php/php-src/branches/PHP_5_4/NEWS 2011-11-15 22:40:10 UTC (rev 319282) @@ -34,6 +34,7 @@ - Improved PHP-FPM SAPI: . enhance error log when the primary script can't be open. FR #60199. (fat) + . remove EXPERIMENTAL flag. (fat) 11 Nov 2011, PHP 5.4.0 RC1 Modified: php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 === --- php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 2011-11-15 22:29:59 UTC (rev 319281) +++ php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 2011-11-15 22:40:10 UTC (rev 319282) @@ -3,7 +3,7 @@ dnl PHP_ARG_ENABLE(fpm,, -[ --enable-fpm EXPERIMENTAL: Enable building of the fpm SAPI executable], no, no) +[ --enable-fpm Enable building of the fpm SAPI executable], no, no) dnl configure checks {{{ AC_DEFUN([AC_FPM_STDLIBS], Modified: php/php-src/trunk/sapi/fpm/config.m4 === --- php/php-src/trunk/sapi/fpm/config.m42011-11-15 22:29:59 UTC (rev 319281) +++ php/php-src/trunk/sapi/fpm/config.m42011-11-15 22:40:10 UTC (rev 319282) @@ -3,7 +3,7 @@ dnl PHP_ARG_ENABLE(fpm,, -[ --enable-fpm EXPERIMENTAL: Enable building of the fpm SAPI executable], no, no) +[ --enable-fpm Enable building of the fpm SAPI executable], no, no) dnl configure checks {{{ AC_DEFUN([AC_FPM_STDLIBS], -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/ PHP_5_3/NEWS PHP_5_4/NEWS
fat Wed, 16 Nov 2011 00:19:43 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319286 Log: typo Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_4/NEWS Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-11-15 23:38:19 UTC (rev 319285) +++ php/php-src/branches/PHP_5_3/NEWS 2011-11-16 00:19:43 UTC (rev 319286) @@ -10,7 +10,7 @@ - PHP-FPM SAPI: . Fixed bug #60179 (php_flag and php_value does not work properly). (fat) - . enhance error log when the primary script can't be open. FR #60199. (fat) + . Enhance error log when the primary script can't be open. FR #60199. (fat) - Intl: . Fixed bug #60192 (SegFault when Collator not constructed Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-11-15 23:38:19 UTC (rev 319285) +++ php/php-src/branches/PHP_5_4/NEWS 2011-11-16 00:19:43 UTC (rev 319286) @@ -33,8 +33,8 @@ . Fixed bug #55759 (memory leak when using built-in server). (Laruence) - Improved PHP-FPM SAPI: - . enhance error log when the primary script can't be open. FR #60199. (fat) - . remove EXPERIMENTAL flag. (fat) + . Enhance error log when the primary script can't be open. FR #60199. (fat) + . Remove EXPERIMENTAL flag. (fat) 11 Nov 2011, PHP 5.4.0 RC1 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c branches/PHP_5_4/NEWS branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c trunk/sapi/fpm/fpm/fpm_conf.c
fat Wed, 16 Nov 2011 00:21:38 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319287 Log: - Added .phar to default authorized extensions Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-11-16 00:19:43 UTC (rev 319286) +++ php/php-src/branches/PHP_5_3/NEWS 2011-11-16 00:21:38 UTC (rev 319287) @@ -11,6 +11,7 @@ - PHP-FPM SAPI: . Fixed bug #60179 (php_flag and php_value does not work properly). (fat) . Enhance error log when the primary script can't be open. FR #60199. (fat) + . Added .phar to default authorized extensions. (fat) - Intl: . Fixed bug #60192 (SegFault when Collator not constructed Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-11-16 00:19:43 UTC (rev 319286) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-11-16 00:21:38 UTC (rev 319287) @@ -973,7 +973,7 @@ /* security.limit_extensions */ if (!wp-config-security_limit_extensions) { - wp-config-security_limit_extensions = strdup(.php); + wp-config-security_limit_extensions = strdup(.php .phar); } if (*wp-config-security_limit_extensions) { Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-11-16 00:19:43 UTC (rev 319286) +++ php/php-src/branches/PHP_5_4/NEWS 2011-11-16 00:21:38 UTC (rev 319287) @@ -35,6 +35,7 @@ - Improved PHP-FPM SAPI: . Enhance error log when the primary script can't be open. FR #60199. (fat) . Remove EXPERIMENTAL flag. (fat) + . Added .phar to default authorized extensions. (fat) 11 Nov 2011, PHP 5.4.0 RC1 Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-11-16 00:19:43 UTC (rev 319286) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-11-16 00:21:38 UTC (rev 319287) @@ -973,7 +973,7 @@ /* security.limit_extensions */ if (!wp-config-security_limit_extensions) { - wp-config-security_limit_extensions = strdup(.php); + wp-config-security_limit_extensions = strdup(.php .phar); } if (*wp-config-security_limit_extensions) { Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-11-16 00:19:43 UTC (rev 319286) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-11-16 00:21:38 UTC (rev 319287) @@ -973,7 +973,7 @@ /* security.limit_extensions */ if (!wp-config-security_limit_extensions) { - wp-config-security_limit_extensions = strdup(.php); + wp-config-security_limit_extensions = strdup(.php .phar); } if (*wp-config-security_limit_extensions) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c trunk/sapi/fpm/fpm/fpm_conf.c
fat Thu, 03 Nov 2011 15:47:19 + Revision: http://svn.php.net/viewvc?view=revisionrevision=318743 Log: - Fixed bug #60179 (php_flag and php_value does not work properly) Bug: https://bugs.php.net/60179 (Assigned) php_flag and php_value does not work properly Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-11-03 15:26:34 UTC (rev 318742) +++ php/php-src/branches/PHP_5_3/NEWS 2011-11-03 15:47:19 UTC (rev 318743) @@ -2,7 +2,10 @@ ||| ?? ??? 2011, PHP 5.3.9 +- PHP-FPM SAPI: + . Fixed bug #60179 (php_flag and php_value does not work properly). (fat) + 03 Nov 2011, PHP 5.3.9RC1 - Core: Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-11-03 15:26:34 UTC (rev 318742) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-11-03 15:47:19 UTC (rev 318743) @@ -539,7 +539,7 @@ if (convert_to_bool) { char *err = fpm_conf_set_boolean(value, subconf, 0); if (err) return err; - kv-value = strdup(b ? On : Off); + kv-value = strdup(b ? 1 : 0); } else { kv-value = strdup(Z_STRVAL_P(value)); if (fpm_conf_expand_pool_name(kv-value) == -1) { @@ -1343,20 +1343,10 @@ err = fpm_conf_set_array(key, value, config, 0); } else if (!strcmp(php_value, Z_STRVAL_P(name))) { - if (!*Z_STRVAL_P(value)) { - zlog(ZLOG_ERROR, [%s:%d] empty value, ini_filename, ini_lineno); - *error = 1; - return; - } config = (char *)current_wp-config + WPO(php_values); err = fpm_conf_set_array(key, value, config, 0); } else if (!strcmp(php_admin_value, Z_STRVAL_P(name))) { - if (!*Z_STRVAL_P(value)) { - zlog(ZLOG_ERROR, [%s:%d] empty value, ini_filename, ini_lineno); - *error = 1; - return; - } config = (char *)current_wp-config + WPO(php_admin_values); err = fpm_conf_set_array(key, value, config, 0); Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-11-03 15:26:34 UTC (rev 318742) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-11-03 15:47:19 UTC (rev 318743) @@ -539,7 +539,7 @@ if (convert_to_bool) { char *err = fpm_conf_set_boolean(value, subconf, 0); if (err) return err; - kv-value = strdup(b ? On : Off); + kv-value = strdup(b ? 1 : 0); } else { kv-value = strdup(Z_STRVAL_P(value)); if (fpm_conf_expand_pool_name(kv-value) == -1) { @@ -1343,20 +1343,10 @@ err = fpm_conf_set_array(key, value, config, 0); } else if (!strcmp(php_value, Z_STRVAL_P(name))) { - if (!*Z_STRVAL_P(value)) { - zlog(ZLOG_ERROR, [%s:%d] empty value, ini_filename, ini_lineno); - *error = 1; - return; - } config = (char *)current_wp-config + WPO(php_values); err = fpm_conf_set_array(key, value, config, 0); } else if (!strcmp(php_admin_value, Z_STRVAL_P(name))) { - if (!*Z_STRVAL_P(value)) { - zlog(ZLOG_ERROR, [%s:%d] empty value, ini_filename, ini_lineno); - *error = 1; - return; - } config = (char *)current_wp-config + WPO(php_admin_values); err = fpm_conf_set_array(key, value, config, 0); Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-11-03 15:26:34 UTC (rev 318742) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-11-03 15:47:19 UTC (rev 318743) @@ -539,7 +539,7 @@ if (convert_to_bool) { char *err = fpm_conf_set_boolean(value, subconf, 0); if (err) return err; - kv-value = strdup(b ? On : Off); + kv-value = strdup(b ? 1 : 0); } else { kv-value = strdup(Z_STRVAL_P(value));
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/fpm/config.m4 trunk/sapi/fpm/config.m4
fat Sun, 09 Oct 2011 09:22:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317934 Log: - fix r317922 (missing PHP_ADD_BUILD_DIR(sapi/fpm/fpm/events) in config.m4) Changed paths: U php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 U php/php-src/trunk/sapi/fpm/config.m4 Modified: php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 === --- php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 2011-10-09 07:13:12 UTC (rev 317933) +++ php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 2011-10-09 09:22:36 UTC (rev 317934) @@ -583,6 +583,7 @@ 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_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag]) Modified: php/php-src/trunk/sapi/fpm/config.m4 === --- php/php-src/trunk/sapi/fpm/config.m42011-10-09 07:13:12 UTC (rev 317933) +++ php/php-src/trunk/sapi/fpm/config.m42011-10-09 09:22:36 UTC (rev 317934) @@ -583,6 +583,7 @@ 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_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag]) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c trunk/sapi/fpm/fpm/fpm_main.c
fat Sun, 09 Oct 2011 14:36:11 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317936 Log: - Fixed bug #55533 (The -d parameter doesn't work) Bug: https://bugs.php.net/55533 (Assigned) The -d parameter doesn't work Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-09 11:13:27 UTC (rev 317935) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-09 14:36:11 UTC (rev 317936) @@ -75,6 +75,7 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Fixed bug #55533 (The -d parameter doesn't work). (fat) . Implemented FR #52569 (Add the ondemand process-manager to allow zero children). (fat) . Fixed bug #55486 (status show BIG processes number). (fat) Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-10-09 11:13:27 UTC (rev 317935) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-10-09 14:36:11 UTC (rev 317936) @@ -1528,6 +1528,7 @@ char *fpm_prefix = NULL; char *fpm_pid = NULL; int test_conf = 0; + int php_information = 0; fcgi_init(); @@ -1638,20 +1639,8 @@ goto out; case 'i': /* php info quit */ - cgi_sapi_module.phpinfo_as_text = 1; - cgi_sapi_module.startup(cgi_sapi_module); - if (php_request_startup(TSRMLS_C) == FAILURE) { - SG(server_context) = NULL; - php_module_shutdown(TSRMLS_C); - return FAILURE; - } - SG(headers_sent) = 1; - SG(request_info).no_headers = 1; - php_print_info(0x TSRMLS_CC); - php_request_shutdown((void *) 0); - fcgi_shutdown(); - exit_status = 0; - goto out; + php_information = 1; + break; default: case 'h': @@ -1688,6 +1677,23 @@ } } + if (php_information) { + cgi_sapi_module.phpinfo_as_text = 1; + cgi_sapi_module.startup(cgi_sapi_module); + if (php_request_startup(TSRMLS_C) == FAILURE) { + SG(server_context) = NULL; + php_module_shutdown(TSRMLS_C); + return FAILURE; + } + SG(headers_sent) = 1; + SG(request_info).no_headers = 1; + php_print_info(0x TSRMLS_CC); + php_request_shutdown((void *) 0); + fcgi_shutdown(); + exit_status = 0; + goto out; + } + /* No other args are permitted here as there is not interactive mode */ if (argc != php_optind) { cgi_sapi_module.startup(cgi_sapi_module); Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-10-09 11:13:27 UTC (rev 317935) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-10-09 14:36:11 UTC (rev 317936) @@ -1521,6 +1521,7 @@ char *fpm_prefix = NULL; char *fpm_pid = NULL; int test_conf = 0; + int php_information = 0; #ifdef HAVE_SIGNAL_H #if defined(SIGPIPE) defined(SIG_IGN) @@ -1632,20 +1633,8 @@ goto out; case 'i': /* php info quit */ - cgi_sapi_module.phpinfo_as_text = 1; - cgi_sapi_module.startup(cgi_sapi_module); - if (php_request_startup(TSRMLS_C) == FAILURE) { - SG(server_context) = NULL; - php_module_shutdown(TSRMLS_C); - return FAILURE; - } - SG(headers_sent) = 1; - SG(request_info).no_headers = 1; - php_print_info(0x TSRMLS_CC); - php_request_shutdown((void *) 0); -
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fpm.c branches/PHP_5_3/sapi/fpm/fpm/fpm.h branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c branches/PHP_5_3/sapi/fpm/fpm/fpm_ev
fat Sun, 09 Oct 2011 15:12:26 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317937 Log: - Fixed bug #55526 (Heartbeat causes a lot of unnecessary events) Bug: https://bugs.php.net/55526 (Analyzed) Heartbeat causes a lot of unnecessary events Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.h U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_events.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_process_ctl.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_process_ctl.h U php/php-src/trunk/sapi/fpm/fpm/fpm.c U php/php-src/trunk/sapi/fpm/fpm/fpm.h U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_events.c U php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c U php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.h Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-09 14:36:11 UTC (rev 317936) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-09 15:12:26 UTC (rev 317937) @@ -75,6 +75,7 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Fixed bug #55526 (Heartbeat causes a lot of unnecessary events). (fat) . Fixed bug #55533 (The -d parameter doesn't work). (fat) . Implemented FR #52569 (Add the ondemand process-manager to allow zero children). (fat) Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2011-10-09 14:36:11 UTC (rev 317936) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2011-10-09 15:12:26 UTC (rev 317937) @@ -36,7 +36,8 @@ .listening_socket = 0, .max_requests = 0, .is_child = 0, - .test_successful = 0 + .test_successful = 0, + .heartbeat = 0 }; int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */ Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h 2011-10-09 14:36:11 UTC (rev 317936) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h 2011-10-09 15:12:26 UTC (rev 317937) @@ -24,6 +24,7 @@ int max_requests; /* for this child */ int is_child; int test_successful; + int heartbeat; }; extern struct fpm_globals_s fpm_globals; Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-09 14:36:11 UTC (rev 317936) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-09 15:12:26 UTC (rev 317937) @@ -878,6 +878,10 @@ } } + if (wp-config-request_terminate_timeout) { + fpm_globals.heartbeat = fpm_globals.heartbeat ? MIN(fpm_globals.heartbeat, (wp-config-request_terminate_timeout * 1000) / 3) : (wp-config-request_terminate_timeout * 1000) / 3; + } + /* slowlog */ if (wp-config-slowlog *wp-config-slowlog) { fpm_evaluate_full_path(wp-config-slowlog, wp, NULL, 0); @@ -912,6 +916,8 @@ } close(fd); } + + fpm_globals.heartbeat = fpm_globals.heartbeat ? MIN(fpm_globals.heartbeat, (wp-config-request_slowlog_timeout * 1000) / 3) : (wp-config-request_slowlog_timeout * 1000) / 3; } /* chroot */ Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c 2011-10-09 14:36:11 UTC (rev 317936) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c 2011-10-09 15:12:26 UTC (rev 317937) @@ -350,7 +350,9 @@ fpm_event_add(signal_fd_event, 0); /* add timers */ - fpm_pctl_heartbeat(NULL, 0, NULL); + if (fpm_globals.heartbeat 0) { + fpm_pctl_heartbeat(NULL, 0, NULL); + } if (!err) { fpm_pctl_perform_idle_server_maintenance_heartbeat(NULL, 0, NULL); Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-09 14:36:11 UTC (rev 317936) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-09 15:12:26 UTC (rev 317937) @@ -453,9 +453,13 @@ return; } + /* ensure heartbeat is
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c trunk/sapi/fpm/fpm/fpm_conf.c
fat Sun, 09 Oct 2011 15:21:06 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317938 Log: - ensure request_terminate_timeout = request_slowlog_timeout Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-10-09 15:12:26 UTC (rev 317937) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-10-09 15:21:06 UTC (rev 317938) @@ -918,6 +918,11 @@ } fpm_globals.heartbeat = fpm_globals.heartbeat ? MIN(fpm_globals.heartbeat, (wp-config-request_slowlog_timeout * 1000) / 3) : (wp-config-request_slowlog_timeout * 1000) / 3; + + if (wp-config-request_terminate_timeout wp-config-request_slowlog_timeout wp-config-request_terminate_timeout) { + zlog(ZLOG_ERROR, [pool %s] 'request_slowlog_timeout' (%d) can't be greater than 'request_terminate_timeout' (%d), wp-config-name, wp-config-request_slowlog_timeout, wp-config-request_terminate_timeout); + return -1; + } } /* chroot */ Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-10-09 15:12:26 UTC (rev 317937) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-10-09 15:21:06 UTC (rev 317938) @@ -918,6 +918,11 @@ } fpm_globals.heartbeat = fpm_globals.heartbeat ? MIN(fpm_globals.heartbeat, (wp-config-request_slowlog_timeout * 1000) / 3) : (wp-config-request_slowlog_timeout * 1000) / 3; + + if (wp-config-request_terminate_timeout wp-config-request_slowlog_timeout wp-config-request_terminate_timeout) { + zlog(ZLOG_ERROR, [pool %s] 'request_slowlog_timeout' (%d) can't be greater than 'request_terminate_timeout' (%d), wp-config-name, wp-config-request_slowlog_timeout, wp-config-request_terminate_timeout); + return -1; + } } /* chroot */ Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-10-09 15:12:26 UTC (rev 317937) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-10-09 15:21:06 UTC (rev 317938) @@ -918,6 +918,11 @@ } fpm_globals.heartbeat = fpm_globals.heartbeat ? MIN(fpm_globals.heartbeat, (wp-config-request_slowlog_timeout * 1000) / 3) : (wp-config-request_slowlog_timeout * 1000) / 3; + + if (wp-config-request_terminate_timeout wp-config-request_slowlog_timeout wp-config-request_terminate_timeout) { + zlog(ZLOG_ERROR, [pool %s] 'request_slowlog_timeout' (%d) can't be greater than 'request_terminate_timeout' (%d), wp-config-name, wp-config-request_slowlog_timeout, wp-config-request_terminate_timeout); + return -1; + } } /* chroot */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS
fat Sat, 08 Oct 2011 13:33:38 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317891 Log: fix ws Changed paths: U php/php-src/branches/PHP_5_3/NEWS Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:31:56 UTC (rev 317890) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:33:38 UTC (rev 317891) @@ -75,7 +75,7 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: - . Implemented FR #54577 (Enhanced status page with full status and details + . Implemented FR #54577 (Enhanced status page with full status and details about each processes. Also provide a web page (status.html) for real-time FPM status. (fat) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/fpm/fpm_stdio.c sapi/fpm/fpm/zlog.c sapi/fpm/fpm/zlog.h sapi/fpm/php-fpm.conf.in
fat Sat, 08 Oct 2011 13:35:03 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317892 Log: - Backported FR #52052 from 5.4 branch (Added partial syslog support) Bug: https://bugs.php.net/52052 (Analyzed) add syslog support to FPM Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.h U php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:33:38 UTC (rev 317891) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:35:03 UTC (rev 317892) @@ -75,6 +75,7 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Backported FR #52052 from 5.4 branch (Added partial syslog support). (fat) . Implemented FR #54577 (Enhanced status page with full status and details about each processes. Also provide a web page (status.html) for real-time FPM status. (fat) Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 13:33:38 UTC (rev 317891) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 13:35:03 UTC (rev 317892) @@ -31,6 +31,7 @@ #include zend_ini_scanner.h #include zend_globals.h #include zend_stream.h +#include php_syslog.h #include fpm.h #include fpm_conf.h @@ -58,8 +59,16 @@ static char *fpm_conf_set_log_level(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_rlimit_core(zval *value, void **config, intptr_t offset); static char *fpm_conf_set_pm(zval *value, void **config, intptr_t offset); +#ifdef HAVE_SYSLOG_H +static char *fpm_conf_set_syslog_facility(zval *value, void **config, intptr_t offset); +#endif -struct fpm_global_config_s fpm_global_config = { .daemonize = 1 }; +struct fpm_global_config_s fpm_global_config = { + .daemonize = 1, +#ifdef HAVE_SYSLOG_H + .syslog_facility = -1 +#endif +}; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; static char *ini_filename = NULL; @@ -67,15 +76,19 @@ static char *ini_include = NULL; static struct ini_value_parser_s ini_fpm_global_options[] = { - { emergency_restart_threshold, fpm_conf_set_integer, GO(emergency_restart_threshold) }, - { emergency_restart_interval, fpm_conf_set_time,GO(emergency_restart_interval) }, - { process_control_timeout, fpm_conf_set_time,GO(process_control_timeout) }, - { daemonize, fpm_conf_set_boolean, GO(daemonize) }, - { pid, fpm_conf_set_string, GO(pid_file) }, - { error_log, fpm_conf_set_string, GO(error_log) }, - { log_level, fpm_conf_set_log_level, 0 }, - { rlimit_files,fpm_conf_set_integer, GO(rlimit_files) }, - { rlimit_core, fpm_conf_set_rlimit_core, GO(rlimit_core) }, + { emergency_restart_threshold, fpm_conf_set_integer, GO(emergency_restart_threshold) }, + { emergency_restart_interval, fpm_conf_set_time,GO(emergency_restart_interval) }, + { process_control_timeout, fpm_conf_set_time,GO(process_control_timeout) }, + { daemonize, fpm_conf_set_boolean, GO(daemonize) }, + { pid, fpm_conf_set_string, GO(pid_file) }, + { error_log, fpm_conf_set_string, GO(error_log) }, + { log_level, fpm_conf_set_log_level, GO(log_level) }, +#ifdef HAVE_SYSLOG_H + { syslog.ident,fpm_conf_set_string, GO(syslog_ident) }, + { syslog.facility, fpm_conf_set_syslog_facility, GO(syslog_facility) }, +#endif + { rlimit_files,fpm_conf_set_integer, GO(rlimit_files) }, + { rlimit_core, fpm_conf_set_rlimit_core, GO(rlimit_core) }, { 0, 0, 0 } }; @@ -252,25 +265,178 @@ static char *fpm_conf_set_log_level(zval *value, void **config, intptr_t offset) /* {{{ */ { char *val = Z_STRVAL_P(value); + int log_level; if (!strcasecmp(val, debug)) { - fpm_globals.log_level = ZLOG_DEBUG; + log_level = ZLOG_DEBUG; } else if (!strcasecmp(val, notice)) { - fpm_globals.log_level = ZLOG_NOTICE; + log_level = ZLOG_NOTICE; } else if (!strcasecmp(val, warning) || !strcasecmp(val, warn)) { - fpm_globals.log_level = ZLOG_WARNING; + log_level = ZLOG_WARNING; } else if (!strcasecmp(val, error)) { - fpm_globals.log_level = ZLOG_ERROR; + log_level = ZLOG_ERROR; } else if (!strcasecmp(val, alert)) {
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS sapi/fpm/php-fpm.conf.in
fat Sat, 08 Oct 2011 13:38:28 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317893 Log: - Backported FR #54098 from 5.4 branch (Lowered process manager default value) Bug: https://bugs.php.net/54098 (Analyzed) Overly high defaults in config Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:35:03 UTC (rev 317892) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:38:28 UTC (rev 317893) @@ -75,6 +75,8 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Backported FR #54098 from 5.4 branch (Lowered process manager +default value). (fat) . Backported FR #52052 from 5.4 branch (Added partial syslog support). (fat) . Implemented FR #54577 (Enhanced status page with full status and details about each processes. Also provide a web page (status.html) for Modified: php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in === --- php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in 2011-10-08 13:35:03 UTC (rev 317892) +++ php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in 2011-10-08 13:38:28 UTC (rev 317893) @@ -170,25 +170,26 @@ ; This value sets the limit on the number of simultaneous requests that will be ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to either 'static' or 'dynamic' ; Note: This value is mandatory. -pm.max_children = 50 +pm.max_children = 5 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -;pm.start_servers = 20 +pm.start_servers = 2 ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' -;pm.min_spare_servers = 5 +pm.min_spare_servers = 1 ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' -;pm.max_spare_servers = 35 +pm.max_spare_servers = 3 ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/fpm_php.c sapi/fpm/fpm/fpm_php.h sapi/fpm/fpm/fpm_worker_pool.h
fat Sat, 08 Oct 2011 13:42:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317894 Log: - Backported FR #55181 from 5.4 branch (Enhance security by limiting access to user defined extensions) Bug: https://bugs.php.net/55181 (Analyzed) Enhance security by limiting the script extension Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_worker_pool.h U php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:38:28 UTC (rev 317893) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:42:31 UTC (rev 317894) @@ -75,6 +75,8 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Backported FR #55181 from 5.4 branch (Enhance security by limiting access +to user defined extensions). (fat) . Backported FR #54098 from 5.4 branch (Lowered process manager default value). (fat) . Backported FR #52052 from 5.4 branch (Added partial syslog support). (fat) Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 13:38:28 UTC (rev 317893) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 13:42:31 UTC (rev 317894) @@ -121,6 +121,7 @@ { ping.response, fpm_conf_set_string, WPO(ping_response) }, { access.log,fpm_conf_set_string, WPO(access_log) }, { access.format, fpm_conf_set_string, WPO(access_format) }, + { security.limit_extensions, fpm_conf_set_string, WPO(security_limit_extensions) }, { 0, 0, 0 } }; @@ -599,6 +600,7 @@ free(wpc-prefix); free(wpc-access_log); free(wpc-access_format); + free(wpc-security_limit_extensions); return 0; } @@ -845,6 +847,56 @@ } } + if (!wp-config-security_limit_extensions) { + wp-config-security_limit_extensions = strdup(.php); + } + + if (*wp-config-security_limit_extensions) { + int nb_ext; + char *ext; + char *security_limit_extensions; + char *limit_extensions; + + + /* strdup because strtok(3) alters the string it parses */ + security_limit_extensions = strdup(wp-config-security_limit_extensions); + limit_extensions = security_limit_extensions; + nb_ext = 0; + + /* find the number of extensions */ + while ((ext = strtok(limit_extensions, \t))) { +limit_extensions = NULL; +nb_ext++; + } + free(security_limit_extensions); + + /* if something found */ + if (nb_ext 0) { + +/* malloc the extension array */ +wp-limit_extensions = malloc(sizeof(char *) * (nb_ext + 1)); +if (!wp-limit_extensions) { + zlog(ZLOG_ERROR, [pool %s] unable to malloc extensions array, wp-config-name); + return -1; +} + +/* strdup because strtok(3) alters the string it parses */ +security_limit_extensions = strdup(wp-config-security_limit_extensions); +limit_extensions = security_limit_extensions; +nb_ext = 0; + +/* parse the string and save the extension in the array */ +while ((ext = strtok(security_limit_extensions, \t))) { + security_limit_extensions = NULL; + wp-limit_extensions[nb_ext++] = strdup(ext); +} + +/* end the array with NULL in order to parse it */ +wp-limit_extensions[nb_ext] = NULL; +free(security_limit_extensions); + } + } + if (wp-config-chroot *wp-config-chroot) { fpm_evaluate_full_path(wp-config-chroot, wp, NULL, 1); @@ -1380,6 +1432,7 @@ zlog(ZLOG_NOTICE, \tslowlog = %s,STR2STR(wp-config-slowlog)); zlog(ZLOG_NOTICE, \trlimit_files = %d, wp-config-rlimit_files); zlog(ZLOG_NOTICE, \trlimit_core = %d,wp-config-rlimit_core); + zlog(ZLOG_NOTICE, \tsecurity.limit_extensions = %s, wp-config-security_limit_extensions); for (kv = wp-config-env; kv; kv = kv-next) { zlog(ZLOG_NOTICE, \tenv[%s] = %s, kv-key, kv-value); Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h 2011-10-08 13:38:28 UTC (rev 317893) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h 2011-10-08 13:42:31 UTC (rev 317894) @@ -66,6 +66,7 @@ char *listen_group; char *listen_mode; char *listen_allowed_clients; + char *security_limit_extensions; struct key_value_s *env; struct key_value_s *php_admin_values; struct
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS sapi/fpm/fpm/fpm_children.c sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/php-fpm.conf.in
fat Sat, 08 Oct 2011 13:47:52 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317896 Log: - Backported FR #55166 from 5.4 branch (Added process.max to control the number of process FPM can fork) Bug: https://bugs.php.net/55166 (Analyzed) Implement a global limit to the overall number of php processes Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h U php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:43:33 UTC (rev 317895) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 13:47:52 UTC (rev 317896) @@ -75,6 +75,8 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Backported FR #55166 from 5.4 branch (Added process.max to control +the number of process FPM can fork). (fat) . Backported FR #55181 from 5.4 branch (Enhance security by limiting access to user defined extensions). (fat) . Backported FR #54098 from 5.4 branch (Lowered process manager Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c2011-10-08 13:43:33 UTC (rev 317895) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c2011-10-08 13:47:52 UTC (rev 317896) @@ -362,6 +362,7 @@ pid_t pid; struct fpm_child_s *child; int max; + static int warned = 0; if (wp-config-pm == PM_STYLE_DYNAMIC) { if (!in_event_loop) { /* starting */ @@ -373,7 +374,16 @@ max = wp-config-pm_max_children; } - while (fpm_pctl_can_spawn_children() wp-running_children max) { + /* +* fork children while: +* - fpm_pctl_can_spawn_children : FPM is running in a NORMAL state (aka not restart, stop or reload) +* - wp-running_children max : there is less than the max process for the current pool +* - (fpm_global_config.process_max 1 || fpm_globals.running_children fpm_global_config.process_max): +* if fpm_global_config.process_max is set, FPM has not fork this number of processes (globaly) +*/ + while (fpm_pctl_can_spawn_children() wp-running_children max (fpm_global_config.process_max 1 || fpm_globals.running_children fpm_global_config.process_max)) { + + warned = 0; child = fpm_resources_prepare(wp); if (!child) { @@ -406,6 +416,11 @@ } + if (!warned fpm_global_config.process_max 0 fpm_globals.running_children = fpm_global_config.process_max) { + warned = 1; + zlog(ZLOG_WARNING, The maximum number of processes has been reached. Please review your configuration and consider raising 'process.max'); + } + return 1; /* we are done */ } /* }}} */ Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-10-08 13:43:33 UTC (rev 317895) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-10-08 13:47:52 UTC (rev 317896) @@ -66,8 +66,9 @@ struct fpm_global_config_s fpm_global_config = { .daemonize = 1, #ifdef HAVE_SYSLOG_H - .syslog_facility = -1 + .syslog_facility = -1, #endif + .process_max = 0, }; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; @@ -79,6 +80,7 @@ { emergency_restart_threshold, fpm_conf_set_integer, GO(emergency_restart_threshold) }, { emergency_restart_interval, fpm_conf_set_time, GO(emergency_restart_interval) }, { process_control_timeout, fpm_conf_set_time, GO(process_control_timeout) }, + { process.max, fpm_conf_set_integer, GO(process_max) }, { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { pid, fpm_conf_set_string, GO(pid_file) }, { error_log, fpm_conf_set_string, GO(error_log) }, @@ -1014,6 +1016,11 @@ fpm_globals.log_level = fpm_global_config.log_level; + if (fpm_global_config.process_max 0) { + zlog(ZLOG_ERROR, process_max can't be negative); + return -1; + } + if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup(log/php-fpm.log); } @@ -1394,6 +1401,7 @@ zlog(ZLOG_NOTICE, \tsyslog.facility = %d,
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fastcgi.c fastcgi.h fpm_main.c
fat Sat, 08 Oct 2011 13:52:27 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317897 Log: - backparted from 5.4 branch (remove is_fastcgi because FPM is always fastcgi) Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 13:47:52 UTC (rev 317896) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 13:52:27 UTC (rev 317897) @@ -142,7 +142,6 @@ static HashTable fcgi_mgmt_vars; static int is_initialized = 0; -static int is_fastcgi = 0; static int in_shutdown = 0; static in_addr_t *allowed_clients = NULL; @@ -204,9 +203,7 @@ return 0; } # endif - if ((GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) - (GetStdHandle(STD_ERROR_HANDLE) == INVALID_HANDLE_VALUE) - (GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE)) { + { char *str; DWORD pipe_mode = PIPE_READMODE_BYTE | PIPE_WAIT; HANDLE pipe = GetStdHandle(STD_INPUT_HANDLE); @@ -225,38 +222,16 @@ if (str != NULL) { fcgi_accept_mutex = (HANDLE) atoi(str); } - return is_fastcgi = 1; - } else { - return is_fastcgi = 0; + return 1; } #else - errno = 0; - if (getpeername(0, (struct sockaddr *)sa, len) != 0 errno == ENOTCONN) { - fcgi_setup_signals(); - return is_fastcgi = 1; - } else { - return is_fastcgi = 0; - } + fcgi_setup_signals(); + return 1; #endif } - return is_fastcgi; + return 1; } - -int fcgi_is_fastcgi(void) -{ - if (!is_initialized) { - return fcgi_init(); - } else { - return is_fastcgi; - } -} - -void fcgi_set_is_fastcgi(int new_value) -{ - is_fastcgi = new_value; -} - void fcgi_set_in_shutdown(int new_value) { in_shutdown = new_value; @@ -267,7 +242,6 @@ if (is_initialized) { zend_hash_destroy(fcgi_mgmt_vars); } - is_fastcgi = 0; if (allowed_clients) { free(allowed_clients); } Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h 2011-10-08 13:47:52 UTC (rev 317896) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.h 2011-10-08 13:52:27 UTC (rev 317897) @@ -114,12 +114,10 @@ int fcgi_init(void); void fcgi_shutdown(void); -int fcgi_is_fastcgi(void); void fcgi_init_request(fcgi_request *req, int listen_socket); int fcgi_accept_request(fcgi_request *req); int fcgi_finish_request(fcgi_request *req, int force_close); -void fcgi_set_is_fastcgi(int new_value); void fcgi_set_in_shutdown(int); void fcgi_set_allowed_clients(char *); void fcgi_close(fcgi_request *req, int force, int destroy); Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-10-08 13:47:52 UTC (rev 317896) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-10-08 13:52:27 UTC (rev 317897) @@ -106,6 +106,7 @@ #include fpm/fpm_conf.h #include fpm/fpm_php.h #include fpm/fpm_log.h +#include fpm/zlog.h #ifndef PHP_WIN32 /* XXX this will need to change later when threaded fastcgi is implemented. shane */ @@ -124,6 +125,7 @@ #endif static int request_body_fd; +static int fpm_is_running = 0; static char *sapi_cgibin_getenv(char *name, size_t name_len TSRMLS_DC); static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC); @@ -260,34 +262,33 @@ zend_llist_destroy(sorted_exts); } -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 #endif static inline size_t sapi_cgibin_single_write(const char *str, uint str_length TSRMLS_DC) { -#ifdef PHP_WRITE_STDOUT - long ret; -#else size_t ret; -#endif - if (fcgi_is_fastcgi()) { + /* sapi has started which means everyhting must be send through fcgi */ + if (fpm_is_running) { fcgi_request *request = (fcgi_request*) SG(server_context); - long ret = fcgi_write(request, FCGI_STDOUT, str, str_length); + ret = fcgi_write(request, FCGI_STDOUT, str, str_length); if (ret = 0) { return 0; } return ret; } -#ifdef PHP_WRITE_STDOUT - ret = write(STDOUT_FILENO, str, str_length); - if (ret = 0) return 0; + /* sapi has not started, output to stdout instead of fcgi */ +#ifdef PHP_WRITE_STDOUT + ret = write(STDOUT_FILENO, str, str_length); + if (ret = 0) { + return 0; + } return ret; #else - ret = fwrite(str, 1, MIN(str_length, 16384), stdout); - return ret; + return fwrite(str, 1, MIN(str_length, 16384), stdout); #endif } @@ -313,17 +314,20 @@ static void sapi_cgibin_flush(void *server_context) { - if (fcgi_is_fastcgi())
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fastcgi.c
fat Sat, 08 Oct 2011 13:53:49 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317898 Log: remove unused variable Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 13:52:27 UTC (rev 317897) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 13:53:49 UTC (rev 317898) @@ -185,10 +185,6 @@ int fcgi_init(void) { if (!is_initialized) { -#ifndef _WIN32 - sa_t sa; - socklen_t len = sizeof(sa); -#endif zend_hash_init(fcgi_mgmt_vars, 0, NULL, fcgi_free_mgmt_var_cb, 1); fcgi_set_mgmt_var(FCGI_MPXS_CONNS, sizeof(FCGI_MPXS_CONNS) - 1, 0, sizeof(0)-1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fpm_main.c fpm_php.c
fat Sat, 08 Oct 2011 13:57:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317899 Log: - Backported from 5.4 branch (don't write directly to stderr, use the internal logger instead (zlog)) Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-10-08 13:53:49 UTC (rev 317898) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-10-08 13:57:31 UTC (rev 317899) @@ -656,22 +656,7 @@ TSRMLS_FETCH(); if (CGIG(fcgi_logging)) { - fcgi_request *request; - - request = (fcgi_request*) SG(server_context); - if (request) { - int len = strlen(message); - char *buf = malloc(len+2); - - memcpy(buf, message, len); - memcpy(buf + len, \n, sizeof(\n)); - fcgi_write(request, FCGI_STDERR, buf, len+1); - free(buf); - } else { - fprintf(stderr, %s\n, message); - //FIXME zlog(ZLOG_NOTICE, PHP message: %s, message); - } - /* ignore return code */ + zlog(ZLOG_NOTICE, PHP message: %s, message); } } @@ -1385,14 +1370,14 @@ if (!mode || !arg1) return; if (callback_type != ZEND_INI_PARSER_ENTRY) { - fprintf(stderr, Passing INI directive through FastCGI: only classic entries are allowed\n); + zlog(ZLOG_ERROR, Passing INI directive through FastCGI: only classic entries are allowed); return; } key = Z_STRVAL_P(arg1); if (!key || strlen(key) 1) { - fprintf(stderr, Passing INI directive through FastCGI: empty key\n); + zlog(ZLOG_ERROR, Passing INI directive through FastCGI: empty key); return; } @@ -1401,7 +1386,7 @@ } if (!value) { - fprintf(stderr, Passing INI directive through FastCGI: empty value for key '%s'\n, key); + zlog(ZLOG_ERROR, Passing INI directive through FastCGI: empty value for key '%s', key); return; } @@ -1409,7 +1394,7 @@ kv.value = value; kv.next = NULL; if (fpm_php_apply_defines_ex(kv, *mode) == -1) { - fprintf(stderr, Passing INI directive through FastCGI: unable to set '%s'\n, key); + zlog(ZLOG_ERROR, Passing INI directive through FastCGI: unable to set '%s', key); } } /* }}} */ Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c 2011-10-08 13:53:49 UTC (rev 317898) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c 2011-10-08 13:57:31 UTC (rev 317899) @@ -120,13 +120,13 @@ for (kv = wp-config-php_values; kv; kv = kv-next) { if (fpm_php_apply_defines_ex(kv, ZEND_INI_USER) == -1) { - fprintf(stderr, Unable to set php_value '%s', kv-key); + zlog(ZLOG_ERROR, Unable to set php_value '%s', kv-key); } } for (kv = wp-config-php_admin_values; kv; kv = kv-next) { if (fpm_php_apply_defines_ex(kv, ZEND_INI_SYSTEM) == -1) { - fprintf(stderr, Unable to set php_admin_value '%s', kv-key); + zlog(ZLOG_ERROR, Unable to set php_admin_value '%s', kv-key); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/ fpm/fpm_conf.c fpm/fpm_conf.h php-fpm.conf.in
fat Sat, 08 Oct 2011 14:00:07 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317900 Log: - Backported from 5.4 branch (order fpm configuration items the same way in php-fpm.conf.in, fpm_conf.h and fpm_conf.c) Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h U php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.conf.in Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 13:57:31 UTC (rev 317899) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 14:00:07 UTC (rev 317900) @@ -76,53 +76,59 @@ static int ini_lineno = 0; static char *ini_include = NULL; +/* + * Please keep the same order as in fpm_conf.h and in php-fpm.conf.in + */ static struct ini_value_parser_s ini_fpm_global_options[] = { - { emergency_restart_threshold, fpm_conf_set_integer, GO(emergency_restart_threshold) }, - { emergency_restart_interval, fpm_conf_set_time,GO(emergency_restart_interval) }, - { process_control_timeout, fpm_conf_set_time,GO(process_control_timeout) }, - { process.max, fpm_conf_set_integer, GO(process_max) }, - { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { pid, fpm_conf_set_string, GO(pid_file) }, { error_log, fpm_conf_set_string, GO(error_log) }, - { log_level, fpm_conf_set_log_level, GO(log_level) }, #ifdef HAVE_SYSLOG_H { syslog.ident,fpm_conf_set_string, GO(syslog_ident) }, { syslog.facility, fpm_conf_set_syslog_facility, GO(syslog_facility) }, #endif + { log_level, fpm_conf_set_log_level, GO(log_level) }, + { emergency_restart_threshold, fpm_conf_set_integer, GO(emergency_restart_threshold) }, + { emergency_restart_interval, fpm_conf_set_time,GO(emergency_restart_interval) }, + { process_control_timeout, fpm_conf_set_time,GO(process_control_timeout) }, + { process.max, fpm_conf_set_integer, GO(process_max) }, + { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { rlimit_files,fpm_conf_set_integer, GO(rlimit_files) }, { rlimit_core, fpm_conf_set_rlimit_core, GO(rlimit_core) }, { 0, 0, 0 } }; +/* + * Please keep the same order as in fpm_conf.h and in php-fpm.conf.in + */ static struct ini_value_parser_s ini_fpm_pool_options[] = { { prefix,fpm_conf_set_string, WPO(prefix) }, { user, fpm_conf_set_string, WPO(user) }, { group, fpm_conf_set_string, WPO(group) }, - { chroot,fpm_conf_set_string, WPO(chroot) }, - { chdir, fpm_conf_set_string, WPO(chdir) }, - { request_terminate_timeout, fpm_conf_set_time,WPO(request_terminate_timeout) }, - { request_slowlog_timeout, fpm_conf_set_time,WPO(request_slowlog_timeout) }, - { slowlog, fpm_conf_set_string, WPO(slowlog) }, - { rlimit_files, fpm_conf_set_integer, WPO(rlimit_files) }, - { rlimit_core, fpm_conf_set_rlimit_core, WPO(rlimit_core) }, - { catch_workers_output, fpm_conf_set_boolean, WPO(catch_workers_output) }, { listen,fpm_conf_set_string, WPO(listen_address) }, + { listen.backlog,fpm_conf_set_integer, WPO(listen_backlog) }, { listen.owner, fpm_conf_set_string, WPO(listen_owner) }, { listen.group, fpm_conf_set_string, WPO(listen_group) }, { listen.mode, fpm_conf_set_string, WPO(listen_mode) }, - { listen.backlog,fpm_conf_set_integer, WPO(listen_backlog) }, { listen.allowed_clients,fpm_conf_set_string, WPO(listen_allowed_clients) }, { pm,fpm_conf_set_pm, WPO(pm) }, - { pm.max_requests, fpm_conf_set_integer, WPO(pm_max_requests) }, { pm.max_children, fpm_conf_set_integer, WPO(pm_max_children) }, { pm.start_servers, fpm_conf_set_integer, WPO(pm_start_servers) }, { pm.min_spare_servers, fpm_conf_set_integer, WPO(pm_min_spare_servers) }, { pm.max_spare_servers, fpm_conf_set_integer, WPO(pm_max_spare_servers) }, + { pm.max_requests, fpm_conf_set_integer, WPO(pm_max_requests) }, { pm.status_path,fpm_conf_set_string, WPO(pm_status_path) }, { ping.path, fpm_conf_set_string, WPO(ping_path) }, { ping.response, fpm_conf_set_string, WPO(ping_response) }, { access.log,
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fastcgi.c fpm.c fpm_children.c fpm_cleanup.c fpm_conf.c fpm_conf.h fpm_env.c fpm_events.c fpm_log.c fpm_main.c fpm_php.c fpm_php_trace.c fpm_
fat Sat, 08 Oct 2011 14:04:09 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317901 Log: - Backported from 5.4 branch: * enhanced log messages * code cosmetic Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_cleanup.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_env.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_log.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php_trace.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_signals.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_sockets.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_mach.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_pread.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_ptrace.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_worker_pool.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 14:00:07 UTC (rev 317900) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 14:04:09 UTC (rev 317901) @@ -29,9 +29,9 @@ #include limits.h #include php_config.h -#include fpm/fpm.h -#include fpm/fpm_request.h -#include fpm/zlog.h +#include fpm.h +#include fpm_request.h +#include zlog.h #ifdef _WIN32 @@ -268,7 +268,7 @@ } allowed_clients[n] = inet_addr(cur); if (allowed_clients[n] == INADDR_NONE) { -fprintf(stderr, Wrong IP address '%s' in FCGI_WEB_SERVER_ADDRS or listen.allowed_clients\n, cur); +zlog(ZLOG_ERROR, Wrong IP address '%s' in listen.allowed_clients, cur); } n++; cur = end; @@ -816,7 +816,7 @@ n++; } if (!allowed) { - fprintf(stderr, Connection from disallowed IP address '%s' is dropped.\n, inet_ntoa(sa.sa_inet.sin_addr)); + zlog(ZLOG_ERROR, Connection disallowed: IP address '%s' has been dropped., inet_ntoa(sa.sa_inet.sin_addr)); closesocket(req-fd); req-fd = -1; continue; @@ -872,7 +872,7 @@ } fcgi_close(req, 1, 0); } else { - fprintf(stderr, Too many open file descriptors. FD_SETSIZE limit exceeded.); + zlog(ZLOG_ERROR, Too many open file descriptors. FD_SETSIZE limit exceeded.); fcgi_close(req, 1, 0); } #endif Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2011-10-08 14:00:07 UTC (rev 317900) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2011-10-08 14:04:09 UTC (rev 317901) @@ -65,11 +65,13 @@ if (fpm_globals.test_successful) { exit(0); } else { + zlog(ZLOG_ERROR, FPM initialization failed); return -1; } } if (0 fpm_conf_write_pid()) { + zlog(ZLOG_ERROR, FPM initialization failed); return -1; } Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c 2011-10-08 14:00:07 UTC (rev 317900) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c 2011-10-08 14:04:09 UTC (rev 317901) @@ -147,13 +147,13 @@ { fpm_globals.max_requests = wp-config-pm_max_requests; - if (0 fpm_stdio_init_child(wp) || - 0 fpm_log_init_child(wp) || - 0 fpm_status_init_child(wp) || - 0 fpm_unix_init_child(wp) || - 0 fpm_signals_init_child() || - 0 fpm_env_init_child(wp) || - 0 fpm_php_init_child(wp)) { + if (0 fpm_stdio_init_child(wp) || + 0 fpm_log_init_child(wp)|| + 0 fpm_status_init_child(wp) || + 0 fpm_unix_init_child(wp) || + 0 fpm_signals_init_child() || + 0 fpm_env_init_child(wp)|| + 0 fpm_php_init_child(wp)) { zlog(ZLOG_ERROR, [pool %s] child failed to initialize, wp-config-name); exit(255); @@ -292,7 +292,7 @@ } } } else { - zlog(ZLOG_ALERT, oops, unknown child (%d) exited %s, pid, buf); + zlog(ZLOG_ALERT, oops, unknown child (%d) exited %s. Please open a bug
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS sapi/fpm/fpm/fpm_conf.c
fat Sat, 08 Oct 2011 14:07:47 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317902 Log: - Backported from 5.4 branch (Dropped restriction of not setting the same value multiple times, the last one holds). Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 14:04:09 UTC (rev 317901) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 14:07:47 UTC (rev 317902) @@ -75,6 +75,9 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Backported from 5.4 branch (Dropped restriction of not setting the same +value multiple times, the last one holds). +(giovanni at giacobbi dot net, fat) . Backported FR #55166 from 5.4 branch (Added process.max to control the number of process FPM can fork). (fat) . Backported FR #55181 from 5.4 branch (Enhance security by limiting access Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-10-08 14:04:09 UTC (rev 317901) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c2011-10-08 14:07:47 UTC (rev 317902) @@ -195,21 +195,25 @@ static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset) /* {{{ */ { - char *new; - char **old = (char **) ((char *) *config + offset); - if (*old) { - return it's already been defined. Can't do that twice.; + char **config_val = (char **) ((char *) *config + offset); + + if (!config_val) { + return internal error: NULL value; } - new = strdup(Z_STRVAL_P(value)); - if (!new) { + /* Check if there is a previous value to deallocate */ + if (*config_val) { + free(*config_val); + } + + *config_val = strdup(Z_STRVAL_P(value)); + if (!*config_val) { return fpm_conf_set_string(): strdup() failed; } - if (fpm_conf_expand_pool_name(new) == -1) { + if (fpm_conf_expand_pool_name(config_val) == -1) { return Can't use '$pool' when the pool is not defined; } - *old = new; return NULL; } /* }}} */ @@ -219,8 +223,9 @@ char *val = Z_STRVAL_P(value); char *p; + /* we don't use strtol because we don't want to allow negative values */ for (p = val; *p; p++) { - if ( p == val *p == '-' ) continue; + if (p == val *p == '-') continue; if (*p '0' || *p '9') { return is not a valid number (greater or equal than zero); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fpm_children.c
fat Sat, 08 Oct 2011 14:11:37 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317903 Log: ws Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c2011-10-08 14:07:47 UTC (rev 317902) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c2011-10-08 14:11:37 UTC (rev 317903) @@ -344,6 +344,7 @@ } fpm_scoreboard_free(wp-scoreboard); } + fpm_scoreboard_child_use(child-wp-scoreboard, child-scoreboard_i, getpid()); fpm_stdio_child_use_pipes(child); fpm_child_free(child); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/config.m4 branches/PHP_5_4/sapi/fpm/config.m4 trunk/sapi/fpm/config.m4
fat Sat, 08 Oct 2011 19:31:32 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317913 Log: - Fixed bug #55577 (status.html does not install) Bug: https://bugs.php.net/55577 (Analyzed) status.html does not install Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/config.m4 U php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 U php/php-src/trunk/sapi/fpm/config.m4 Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 15:32:12 UTC (rev 317912) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 19:31:32 UTC (rev 317913) @@ -75,6 +75,7 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Fixed bug #55577 (status.html does not install). (fat) . Backported from 5.4 branch (Dropped restriction of not setting the same value multiple times, the last one holds). (giovanni at giacobbi dot net, fat) Modified: php/php-src/branches/PHP_5_3/sapi/fpm/config.m4 === --- php/php-src/branches/PHP_5_3/sapi/fpm/config.m4 2011-10-08 15:32:12 UTC (rev 317912) +++ php/php-src/branches/PHP_5_3/sapi/fpm/config.m4 2011-10-08 19:31:32 UTC (rev 317913) @@ -411,7 +411,7 @@ 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_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.8) + PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.8 sapi/fpm/status.html) PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag], [$abs_srcdir/sapi/fpm], [sapi/fpm]) SAPI_FPM_PATH=sapi/fpm/php-fpm Modified: php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 === --- php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 2011-10-08 15:32:12 UTC (rev 317912) +++ php/php-src/branches/PHP_5_4/sapi/fpm/config.m4 2011-10-08 19:31:32 UTC (rev 317913) @@ -412,7 +412,7 @@ AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, $php_fpm_group, [fpm group name]) PHP_ADD_BUILD_DIR(sapi/fpm/fpm) - PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.8) + PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm 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 Modified: php/php-src/trunk/sapi/fpm/config.m4 === --- php/php-src/trunk/sapi/fpm/config.m42011-10-08 15:32:12 UTC (rev 317912) +++ php/php-src/trunk/sapi/fpm/config.m42011-10-08 19:31:32 UTC (rev 317913) @@ -412,7 +412,7 @@ AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, $php_fpm_group, [fpm group name]) PHP_ADD_BUILD_DIR(sapi/fpm/fpm) - PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.8) + PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm 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 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c branches/PHP_5_4/sapi/fpm/fpm/fpm_process_ctl.c trunk/sapi/fpm/fpm/fpm_process_ctl.c
fat Sat, 08 Oct 2011 19:50:26 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317915 Log: - Fixed bug #55486 (status show BIG processes number) Bug: https://bugs.php.net/55486 (Analyzed) status show BIG processes number Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_process_ctl.c U php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-10-08 19:35:56 UTC (rev 317914) +++ php/php-src/branches/PHP_5_3/NEWS 2011-10-08 19:50:26 UTC (rev 317915) @@ -75,6 +75,7 @@ . Fixed bug #53872 (internal corruption of phar). (Hannes) - PHP-FPM SAPI: + . Fixed bug #55486 (status show BIG processes number). (fat) . Fixed bug #55577 (status.html does not install). (fat) . Backported from 5.4 branch (Dropped restriction of not setting the same value multiple times, the last one holds). Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-08 19:35:56 UTC (rev 317914) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-08 19:50:26 UTC (rev 317915) @@ -317,7 +317,7 @@ int idle = 0; int active = 0; int children_to_fork; - unsigned cur_lq; + unsigned cur_lq = 0; if (wp-config == NULL) continue; @@ -352,8 +352,8 @@ } #endif } - fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp-scoreboard); } + fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp-scoreboard); /* the rest is only used by PM_STYLE_DYNAMIC */ Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_process_ctl.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-08 19:35:56 UTC (rev 317914) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-08 19:50:26 UTC (rev 317915) @@ -317,7 +317,7 @@ int idle = 0; int active = 0; int children_to_fork; - unsigned cur_lq; + unsigned cur_lq = 0; if (wp-config == NULL) continue; @@ -352,8 +352,8 @@ } #endif } - fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp-scoreboard); } + fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp-scoreboard); /* the rest is only used by PM_STYLE_DYNAMIC */ Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c2011-10-08 19:35:56 UTC (rev 317914) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c2011-10-08 19:50:26 UTC (rev 317915) @@ -317,7 +317,7 @@ int idle = 0; int active = 0; int children_to_fork; - unsigned cur_lq; + unsigned cur_lq = 0; if (wp-config == NULL) continue; @@ -352,8 +352,8 @@ } #endif } - fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp-scoreboard); } + fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, FPM_SCOREBOARD_ACTION_SET, wp-scoreboard); /* the rest is only used by PM_STYLE_DYNAMIC */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c trunk/sapi/fpm/fpm/fpm_main.c
fat Tue, 02 Aug 2011 00:58:51 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314078 Log: - Fixed bug #55340 (segfault when using some arguments -- bug introduced by commit r313351) Bug: https://bugs.php.net/55340 (Analyzed) FPM: SIGSEGV with some arguments Changed paths: U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-08-02 00:55:06 UTC (rev 314077) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-08-02 00:58:51 UTC (rev 314078) @@ -125,6 +125,7 @@ #endif static int request_body_fd; +static int fpm_is_running = 0; static char *sapi_cgibin_getenv(char *name, size_t name_len TSRMLS_DC); static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC); @@ -261,16 +262,34 @@ zend_llist_destroy(sorted_exts); } +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + static inline size_t sapi_cgibin_single_write(const char *str, uint str_length TSRMLS_DC) { - long ret; + size_t ret; - fcgi_request *request = (fcgi_request*) SG(server_context); - ret = fcgi_write(request, FCGI_STDOUT, str, str_length); + /* sapi has started which means everyhting must be send through fcgi */ + if (fpm_is_running) { + fcgi_request *request = (fcgi_request*) SG(server_context); + ret = fcgi_write(request, FCGI_STDOUT, str, str_length); + if (ret = 0) { + return 0; + } + return ret; + } + + /* sapi has not started, output to stdout instead of fcgi */ +#ifdef PHP_WRITE_STDOUT + ret = write(STDOUT_FILENO, str, str_length); if (ret = 0) { return 0; } return ret; +#else + return fwrite(str, 1, MIN(str_length, 16384), stdout); +#endif } static int sapi_cgibin_ub_write(const char *str, uint str_length TSRMLS_DC) @@ -295,12 +314,21 @@ static void sapi_cgibin_flush(void *server_context) { - fcgi_request *request = (fcgi_request*) server_context; - if ( + /* fpm has started, let use fcgi instead of stdout */ + if (fpm_is_running) { + fcgi_request *request = (fcgi_request*) server_context; + if ( #ifndef PHP_WIN32 - !parent + !parent #endif - request !fcgi_flush(request, 0)) { + request !fcgi_flush(request, 0)) { + php_handle_aborted_connection(); + } + return; + } + + /* fpm has not started yet, let use stdout instead of fcgi */ + if (fflush(stdout) == EOF) { php_handle_aborted_connection(); } } @@ -498,8 +526,14 @@ static char *sapi_cgibin_getenv(char *name, size_t name_len TSRMLS_DC) { - fcgi_request *request = (fcgi_request*) SG(server_context); - return fcgi_getenv(request, name, name_len); + /* if fpm has started, use fcgi env */ + if (fpm_is_running) { + fcgi_request *request = (fcgi_request*) SG(server_context); + return fcgi_getenv(request, name, name_len); + } + + /* if fpm has not started yet, use std env */ + return getenv(name); } static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC) @@ -1727,6 +1761,8 @@ return FAILURE; } + fpm_is_running = 1; + fcgi_fd = fpm_run(max_requests); parent = 0; Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-08-02 00:55:06 UTC (rev 314077) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-08-02 00:58:51 UTC (rev 314078) @@ -125,6 +125,7 @@ #endif static int request_body_fd; +static int fpm_is_running = 0; static char *sapi_cgibin_getenv(char *name, size_t name_len TSRMLS_DC); static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC); @@ -261,16 +262,34 @@ zend_llist_destroy(sorted_exts); } +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + static inline size_t sapi_cgibin_single_write(const char *str, uint str_length TSRMLS_DC) { - long ret; + size_t ret; - fcgi_request *request = (fcgi_request*) SG(server_context); - ret = fcgi_write(request, FCGI_STDOUT, str, str_length); + /* sapi has started which means everyhting must be send through fcgi */ + if (fpm_is_running) { + fcgi_request *request = (fcgi_request*) SG(server_context); + ret = fcgi_write(request, FCGI_STDOUT, str, str_length); +
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/NEWS branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c trunk/sapi/fpm/fpm/fpm_conf.c
fat Tue, 19 Jul 2011 22:38:04 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313456 Log: - Dropped restriction of not setting the same value multiple times, the last one holds (giovanni at giacobbi dot net) Changed paths: U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-07-19 22:29:55 UTC (rev 313455) +++ php/php-src/branches/PHP_5_4/NEWS 2011-07-19 22:38:04 UTC (rev 313456) @@ -4,6 +4,8 @@ - Improved PHP-FPM SAPI: . Added process.max to control the number of process FPM can fork. FR #55166. (fat) + . Dropped restriction of not setting the same value multiple times, the last +one holds. (giovanni at giacobbi dot net, fat) 14 Jul 2011, PHP 5.4.0 Alpha 2 - General improvements: Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-19 22:29:55 UTC (rev 313455) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-19 22:38:04 UTC (rev 313456) @@ -195,21 +195,25 @@ static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset) /* {{{ */ { - char *new; - char **old = (char **) ((char *) *config + offset); - if (*old) { - return it's already been defined. Can't do that twice.; + char **config_val = (char **) ((char *) *config + offset); + + if (!config_val) { + return internal error: NULL value; } - new = strdup(Z_STRVAL_P(value)); - if (!new) { + /* Check if there is a previous value to deallocate */ + if (*config_val) { + free(*config_val); + } + + *config_val = strdup(Z_STRVAL_P(value)); + if (!*config_val) { return fpm_conf_set_string(): strdup() failed; } - if (fpm_conf_expand_pool_name(new) == -1) { + if (fpm_conf_expand_pool_name(config_val) == -1) { return Can't use '$pool' when the pool is not defined; } - *old = new; return NULL; } /* }}} */ @@ -219,8 +223,9 @@ char *val = Z_STRVAL_P(value); char *p; + /* we don't use strtol because we don't want to allow negative values */ for (p = val; *p; p++) { - if ( p == val *p == '-' ) continue; + if (p == val *p == '-') continue; if (*p '0' || *p '9') { return is not a valid number (greater or equal than zero); } Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-19 22:29:55 UTC (rev 313455) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-19 22:38:04 UTC (rev 313456) @@ -195,21 +195,25 @@ static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset) /* {{{ */ { - char *new; - char **old = (char **) ((char *) *config + offset); - if (*old) { - return it's already been defined. Can't do that twice.; + char **config_val = (char **) ((char *) *config + offset); + + if (!config_val) { + return internal error: NULL value; } - new = strdup(Z_STRVAL_P(value)); - if (!new) { + /* Check if there is a previous value to deallocate */ + if (*config_val) { + free(*config_val); + } + + *config_val = strdup(Z_STRVAL_P(value)); + if (!*config_val) { return fpm_conf_set_string(): strdup() failed; } - if (fpm_conf_expand_pool_name(new) == -1) { + if (fpm_conf_expand_pool_name(config_val) == -1) { return Can't use '$pool' when the pool is not defined; } - *old = new; return NULL; } /* }}} */ @@ -219,8 +223,9 @@ char *val = Z_STRVAL_P(value); char *p; + /* we don't use strtol because we don't want to allow negative values */ for (p = val; *p; p++) { - if ( p == val *p == '-' ) continue; + if (p == val *p == '-') continue; if (*p '0' || *p '9') { return is not a valid number (greater or equal than zero); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/fpm/fpm/ fastcgi.c
fat Mon, 18 Jul 2011 20:59:18 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313403 Log: remove forgotten debug log Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-07-18 20:38:57 UTC (rev 313402) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-07-18 20:59:18 UTC (rev 313403) @@ -508,7 +508,6 @@ ret = 0; break; } - zlog(ZLOG_DEBUG, %s=%s, tmp, s); zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c trunk/sapi/fpm/fpm/fpm_main.c
fat Mon, 18 Jul 2011 21:03:44 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313405 Log: fix a segfault when passing an empty value to a ini parameter from the web server (php_(admin_)?value) Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-07-18 21:00:59 UTC (rev 313404) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-07-18 21:03:44 UTC (rev 313405) @@ -1430,22 +1430,28 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC) /* {{{ */ { int *mode = (int *)arg; - char *key = Z_STRVAL_P(arg1); - char *value = Z_STRVAL_P(arg2); + char *key; + char *value = NULL; struct key_value_s kv; - if (!mode) return; + if (!mode || !arg1) return; if (callback_type != ZEND_INI_PARSER_ENTRY) { fprintf(stderr, Passing INI directive through FastCGI: only classic entries are allowed\n); return; } + key = Z_STRVAL_P(arg1); + if (!key || strlen(key) 1) { fprintf(stderr, Passing INI directive through FastCGI: empty key\n); return; } + if (arg2) { + value = Z_STRVAL_P(arg2); + } + if (!value) { fprintf(stderr, Passing INI directive through FastCGI: empty value for key '%s'\n, key); return; Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-07-18 21:00:59 UTC (rev 313404) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-07-18 21:03:44 UTC (rev 313405) @@ -1327,22 +1327,28 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC) /* {{{ */ { int *mode = (int *)arg; - char *key = Z_STRVAL_P(arg1); - char *value = Z_STRVAL_P(arg2); + char *key; + char *value = NULL; struct key_value_s kv; - if (!mode) return; + if (!mode || !arg1) return; if (callback_type != ZEND_INI_PARSER_ENTRY) { zlog(ZLOG_ERROR, Passing INI directive through FastCGI: only classic entries are allowed); return; } + key = Z_STRVAL_P(arg1); + if (!key || strlen(key) 1) { zlog(ZLOG_ERROR, Passing INI directive through FastCGI: empty key); return; } + if (arg2) { + value = Z_STRVAL_P(arg2); + } + if (!value) { zlog(ZLOG_ERROR, Passing INI directive through FastCGI: empty value for key '%s', key); return; Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-07-18 21:00:59 UTC (rev 313404) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-07-18 21:03:44 UTC (rev 313405) @@ -1327,22 +1327,28 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC) /* {{{ */ { int *mode = (int *)arg; - char *key = Z_STRVAL_P(arg1); - char *value = Z_STRVAL_P(arg2); + char *key; + char *value = NULL; struct key_value_s kv; - if (!mode) return; + if (!mode || !arg1) return; if (callback_type != ZEND_INI_PARSER_ENTRY) { zlog(ZLOG_ERROR, Passing INI directive through FastCGI: only classic entries are allowed); return; } + key = Z_STRVAL_P(arg1); + if (!key || strlen(key) 1) { zlog(ZLOG_ERROR, Passing INI directive through FastCGI: empty key); return; } + if (arg2) { + value = Z_STRVAL_P(arg2); + } + if (!value) { zlog(ZLOG_ERROR, Passing INI directive through FastCGI: empty value for key '%s', key); return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ NEWS sapi/fpm/fpm/fpm.h sapi/fpm/fpm/fpm_children.c sapi/fpm/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.h sapi/fpm/php-fpm.conf.in
fat Sun, 17 Jul 2011 11:41:57 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313323 Log: - Implemented FR #55166 (Added process.max to control the number of process FPM can fork) Bug: https://bugs.php.net/55166 (Assigned) Implement a global limit to the overall number of php processes Changed paths: U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.h U php/php-src/branches/PHP_5_4/sapi/fpm/php-fpm.conf.in Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-07-17 10:49:25 UTC (rev 313322) +++ php/php-src/branches/PHP_5_4/NEWS 2011-07-17 11:41:57 UTC (rev 313323) @@ -1,6 +1,9 @@ PHP NEWS ||| ?? ??? 2011, PHP 5.4.0 Alpha 3 +- Improved PHP-FPM SAPI: + . Added process.max to control the number of process FPM can fork. FR #55166. +(fat) 14 Jul 2011, PHP 5.4.0 Alpha 2 - General improvements: Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h 2011-07-17 10:49:25 UTC (rev 313322) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h 2011-07-17 11:41:57 UTC (rev 313323) @@ -24,6 +24,7 @@ int max_requests; /* for this child */ int is_child; int test_successful; + int process_max; /* global */ }; extern struct fpm_globals_s fpm_globals; Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c2011-07-17 10:49:25 UTC (rev 313322) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c2011-07-17 11:41:57 UTC (rev 313323) @@ -363,6 +363,7 @@ pid_t pid; struct fpm_child_s *child; int max; + static int warned = 0; if (wp-config-pm == PM_STYLE_DYNAMIC) { if (!in_event_loop) { /* starting */ @@ -374,7 +375,9 @@ max = wp-config-pm_max_children; } - while (fpm_pctl_can_spawn_children() wp-running_children max) { + while (fpm_pctl_can_spawn_children() wp-running_children max fpm_globals.running_children fpm_global_config.process_max) { + + warned = 0; child = fpm_resources_prepare(wp); if (!child) { @@ -407,6 +410,11 @@ } + if (!warned fpm_globals.running_children = fpm_global_config.process_max) { + warned = 1; + zlog(ZLOG_WARNING, The maximum number of processes has been reached. Please review your configuration and consider raising 'process.max'); + } + return 1; /* we are done */ } /* }}} */ Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-17 10:49:25 UTC (rev 313322) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-17 11:41:57 UTC (rev 313323) @@ -66,8 +66,9 @@ struct fpm_global_config_s fpm_global_config = { .daemonize = 1, #ifdef HAVE_SYSLOG_H - .syslog_facility = -1 + .syslog_facility = -1, #endif + .process_max = 0, }; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; @@ -79,6 +80,7 @@ { emergency_restart_threshold, fpm_conf_set_integer, GO(emergency_restart_threshold) }, { emergency_restart_interval, fpm_conf_set_time, GO(emergency_restart_interval) }, { process_control_timeout, fpm_conf_set_time, GO(process_control_timeout) }, + { process.max, fpm_conf_set_integer, GO(process_max) }, { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { pid, fpm_conf_set_string, GO(pid_file) }, { error_log, fpm_conf_set_string, GO(error_log) }, @@ -1014,6 +1016,12 @@ fpm_globals.log_level = fpm_global_config.log_level; + if (fpm_global_config.process_max 0) { + zlog(ZLOG_ERROR, process_max can't be negative); + return -1; + } + fpm_globals.process_max = fpm_global_config.process_max; + if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup(log/php-fpm.log); } @@ -1394,6 +1402,7 @@
[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/sapi/fpm/fpm/ fpm.h fpm_children.c fpm_conf.c
fat Sun, 17 Jul 2011 14:28:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313326 Log: fix revision r313323 Changed paths: U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h 2011-07-17 14:06:05 UTC (rev 313325) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h 2011-07-17 14:28:31 UTC (rev 313326) @@ -24,7 +24,6 @@ int max_requests; /* for this child */ int is_child; int test_successful; - int process_max; /* global */ }; extern struct fpm_globals_s fpm_globals; Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c2011-07-17 14:06:05 UTC (rev 313325) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_children.c2011-07-17 14:28:31 UTC (rev 313326) @@ -375,7 +375,14 @@ max = wp-config-pm_max_children; } - while (fpm_pctl_can_spawn_children() wp-running_children max fpm_globals.running_children fpm_global_config.process_max) { + /* +* fork children while: +* - fpm_pctl_can_spawn_children : FPM is running in a NORMAL state (aka not restart, stop or reload) +* - wp-running_children max : there is less than the max process for the current pool +* - (fpm_global_config.process_max 1 || fpm_globals.running_children fpm_global_config.process_max): +* if fpm_global_config.process_max is set, FPM has not fork this number of processes (globaly) +*/ + while (fpm_pctl_can_spawn_children() wp-running_children max (fpm_global_config.process_max 1 || fpm_globals.running_children fpm_global_config.process_max)) { warned = 0; child = fpm_resources_prepare(wp); @@ -410,7 +417,7 @@ } - if (!warned fpm_globals.running_children = fpm_global_config.process_max) { + if (!warned fpm_global_config.process_max 0 fpm_globals.running_children = fpm_global_config.process_max) { warned = 1; zlog(ZLOG_WARNING, The maximum number of processes has been reached. Please review your configuration and consider raising 'process.max'); } Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-17 14:06:05 UTC (rev 313325) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-17 14:28:31 UTC (rev 313326) @@ -1020,7 +1020,6 @@ zlog(ZLOG_ERROR, process_max can't be negative); return -1; } - fpm_globals.process_max = fpm_global_config.process_max; if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup(log/php-fpm.log); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/sapi/fpm/ fpm/fpm_children.c fpm/fpm_conf.c fpm/fpm_conf.h php-fpm.conf.in
fat Sun, 17 Jul 2011 14:31:32 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313327 Log: backport r313323 and r313326 from PHP_5_4 Changed paths: U php/php-src/trunk/sapi/fpm/fpm/fpm_children.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h U php/php-src/trunk/sapi/fpm/php-fpm.conf.in Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_children.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_children.c 2011-07-17 14:28:31 UTC (rev 313326) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_children.c 2011-07-17 14:31:32 UTC (rev 313327) @@ -363,6 +363,7 @@ pid_t pid; struct fpm_child_s *child; int max; + static int warned = 0; if (wp-config-pm == PM_STYLE_DYNAMIC) { if (!in_event_loop) { /* starting */ @@ -374,7 +375,16 @@ max = wp-config-pm_max_children; } - while (fpm_pctl_can_spawn_children() wp-running_children max) { + /* +* fork children while: +* - fpm_pctl_can_spawn_children : FPM is running in a NORMAL state (aka not restart, stop or reload) +* - wp-running_children max : there is less than the max process for the current pool +* - (fpm_global_config.process_max 1 || fpm_globals.running_children fpm_global_config.process_max): +* if fpm_global_config.process_max is set, FPM has not fork this number of processes (globaly) +*/ + while (fpm_pctl_can_spawn_children() wp-running_children max (fpm_global_config.process_max 1 || fpm_globals.running_children fpm_global_config.process_max)) { + + warned = 0; child = fpm_resources_prepare(wp); if (!child) { @@ -407,6 +417,11 @@ } + if (!warned fpm_global_config.process_max 0 fpm_globals.running_children = fpm_global_config.process_max) { + warned = 1; + zlog(ZLOG_WARNING, The maximum number of processes has been reached. Please review your configuration and consider raising 'process.max'); + } + return 1; /* we are done */ } /* }}} */ Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-17 14:28:31 UTC (rev 313326) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-17 14:31:32 UTC (rev 313327) @@ -66,8 +66,9 @@ struct fpm_global_config_s fpm_global_config = { .daemonize = 1, #ifdef HAVE_SYSLOG_H - .syslog_facility = -1 + .syslog_facility = -1, #endif + .process_max = 0, }; static struct fpm_worker_pool_s *current_wp = NULL; static int ini_recursion = 0; @@ -79,6 +80,7 @@ { emergency_restart_threshold, fpm_conf_set_integer, GO(emergency_restart_threshold) }, { emergency_restart_interval, fpm_conf_set_time, GO(emergency_restart_interval) }, { process_control_timeout, fpm_conf_set_time, GO(process_control_timeout) }, + { process.max, fpm_conf_set_integer, GO(process_max) }, { daemonize, fpm_conf_set_boolean, GO(daemonize) }, { pid, fpm_conf_set_string, GO(pid_file) }, { error_log, fpm_conf_set_string, GO(error_log) }, @@ -962,6 +964,11 @@ fpm_globals.log_level = fpm_global_config.log_level; + if (fpm_global_config.process_max 0) { + zlog(ZLOG_ERROR, process_max can't be negative); + return -1; + } + if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup(log/php-fpm.log); } @@ -1342,6 +1349,7 @@ zlog(ZLOG_NOTICE, \tsyslog.facility = %d, fpm_global_config.syslog_facility); /* FIXME: convert to string */ #endif zlog(ZLOG_NOTICE, \tprocess_control_timeout = %ds, fpm_global_config.process_control_timeout); + zlog(ZLOG_NOTICE, \tprocess.max = %d, fpm_global_config.process_max); zlog(ZLOG_NOTICE, \temergency_restart_interval = %ds, fpm_global_config.emergency_restart_interval); zlog(ZLOG_NOTICE, \temergency_restart_threshold = %d, fpm_global_config.emergency_restart_threshold); zlog(ZLOG_NOTICE, \trlimit_files = %d, fpm_global_config.rlimit_files); Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h 2011-07-17 14:28:31 UTC (rev 313326) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h 2011-07-17 14:31:32 UTC (rev 313327) @@ -32,6 +32,7 @@ #endif int rlimit_files; int rlimit_core; + int process_max; }; extern
[PHP-CVS] svn: /php/php-src/trunk/sapi/fpm/ fpm/fpm_conf.c fpm/fpm_conf.h fpm/fpm_main.c fpm/fpm_php.c fpm/fpm_php.h fpm/fpm_worker_pool.h php-fpm.conf.in
fat Sun, 17 Jul 2011 14:42:58 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313328 Log: backport r313186 from PHP_5_4 Changed paths: U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fpm_php.c U php/php-src/trunk/sapi/fpm/fpm/fpm_php.h U php/php-src/trunk/sapi/fpm/fpm/fpm_worker_pool.h U php/php-src/trunk/sapi/fpm/php-fpm.conf.in Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-17 14:31:32 UTC (rev 313327) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-17 14:42:58 UTC (rev 313328) @@ -123,6 +123,7 @@ { ping.response, fpm_conf_set_string, WPO(ping_response) }, { access.log,fpm_conf_set_string, WPO(access_log) }, { access.format, fpm_conf_set_string, WPO(access_format) }, + { security.limit_extensions, fpm_conf_set_string, WPO(security_limit_extensions) }, { 0, 0, 0 } }; @@ -601,6 +602,7 @@ free(wpc-prefix); free(wpc-access_log); free(wpc-access_format); + free(wpc-security_limit_extensions); return 0; } @@ -847,6 +849,56 @@ } } + if (!wp-config-security_limit_extensions) { + wp-config-security_limit_extensions = strdup(.php); + } + + if (*wp-config-security_limit_extensions) { + int nb_ext; + char *ext; + char *security_limit_extensions; + char *limit_extensions; + + + /* strdup because strtok(3) alters the string it parses */ + security_limit_extensions = strdup(wp-config-security_limit_extensions); + limit_extensions = security_limit_extensions; + nb_ext = 0; + + /* find the number of extensions */ + while ((ext = strtok(limit_extensions, \t))) { + limit_extensions = NULL; + nb_ext++; + } + free(security_limit_extensions); + + /* if something found */ + if (nb_ext 0) { + + /* malloc the extension array */ + wp-limit_extensions = malloc(sizeof(char *) * (nb_ext + 1)); + if (!wp-limit_extensions) { + zlog(ZLOG_ERROR, [pool %s] unable to malloc extensions array, wp-config-name); + return -1; + } + + /* strdup because strtok(3) alters the string it parses */ + security_limit_extensions = strdup(wp-config-security_limit_extensions); + limit_extensions = security_limit_extensions; + nb_ext = 0; + + /* parse the string and save the extension in the array */ + while ((ext = strtok(security_limit_extensions, \t))) { + security_limit_extensions = NULL; + wp-limit_extensions[nb_ext++] = strdup(ext); + } + + /* end the array with NULL in order to parse it */ + wp-limit_extensions[nb_ext] = NULL; + free(security_limit_extensions); + } + } + if (wp-config-chroot *wp-config-chroot) { fpm_evaluate_full_path(wp-config-chroot, wp, NULL, 1); @@ -1388,6 +1440,7 @@ zlog(ZLOG_NOTICE, \tslowlog = %s, STR2STR(wp-config-slowlog)); zlog(ZLOG_NOTICE, \trlimit_files = %d, wp-config-rlimit_files); zlog(ZLOG_NOTICE, \trlimit_core = %d, wp-config-rlimit_core); + zlog(ZLOG_NOTICE, \tsecurity.limit_extensions = %s, wp-config-security_limit_extensions); for (kv = wp-config-env; kv; kv = kv-next) { zlog(ZLOG_NOTICE, \tenv[%s] = %s, kv-key, kv-value); Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h 2011-07-17 14:31:32 UTC (rev 313327) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.h 2011-07-17 14:42:58 UTC (rev 313328) @@ -67,6 +67,7 @@ char *listen_group;
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c branches/PHP_5_3/sapi/fpm/fpm/fpm_config.h branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c branche
fat Sun, 17 Jul 2011 23:33:22 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313347 Log: - get rid of FPM_AUTOCONFIG_H which has never existed since FPM integration into core Changed paths: U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_config.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_config.h U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fastcgi.c U php/php-src/trunk/sapi/fpm/fpm/fpm_config.h U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-07-17 23:26:02 UTC (rev 313346) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-07-17 23:33:22 UTC (rev 313347) @@ -28,13 +28,10 @@ #include errno.h #include limits.h -#ifdef FPM_AUTOCONFIG_H -#include fpm_autoconfig.h -#else #include php_config.h -#endif #include fpm/fpm.h #include fpm/fpm_request.h +#include fpm/zlog.h #ifdef _WIN32 @@ -511,6 +508,7 @@ ret = 0; break; } + zlog(ZLOG_DEBUG, %s=%s, tmp, s); zend_hash_update(req-env, tmp, eff_name_len+1, s, sizeof(char*), NULL); p += name_len + val_len; } Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_config.h === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_config.h 2011-07-17 23:26:02 UTC (rev 313346) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_config.h 2011-07-17 23:33:22 UTC (rev 313347) @@ -3,10 +3,6 @@ #include php_config.h -#ifdef FPM_AUTOCONFIG_H -# include fpm_autoconfig.h -#endif - /* Solaris does not have it */ #ifndef INADDR_NONE # define INADDR_NONE (-1) Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-07-17 23:26:02 UTC (rev 313346) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c2011-07-17 23:33:22 UTC (rev 313347) @@ -99,11 +99,7 @@ #include fastcgi.h -#ifdef FPM_AUTOCONFIG_H -#include fpm_autoconfig.h -#else #include php_config.h -#endif #include fpm/fpm.h #include fpm/fpm_request.h #include fpm/fpm_status.h Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c 2011-07-17 23:26:02 UTC (rev 313346) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c 2011-07-17 23:33:22 UTC (rev 313347) @@ -28,11 +28,7 @@ #include errno.h #include limits.h -#ifdef FPM_AUTOCONFIG_H -#include fpm_autoconfig.h -#else #include php_config.h -#endif #include fpm/fpm.h #include fpm/fpm_request.h Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_config.h === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_config.h 2011-07-17 23:26:02 UTC (rev 313346) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_config.h 2011-07-17 23:33:22 UTC (rev 313347) @@ -3,10 +3,6 @@ #include php_config.h -#ifdef FPM_AUTOCONFIG_H -# include fpm_autoconfig.h -#endif - /* Solaris does not have it */ #ifndef INADDR_NONE # define INADDR_NONE (-1) Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-07-17 23:26:02 UTC (rev 313346) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c2011-07-17 23:33:22 UTC (rev 313347) @@ -99,11 +99,7 @@ #include fastcgi.h -#ifdef FPM_AUTOCONFIG_H -#include fpm_autoconfig.h -#else #include php_config.h -#endif #include fpm/fpm.h #include fpm/fpm_request.h #include fpm/fpm_status.h Modified: php/php-src/trunk/sapi/fpm/fpm/fastcgi.c === --- php/php-src/trunk/sapi/fpm/fpm/fastcgi.c2011-07-17 23:26:02 UTC (rev 313346) +++ php/php-src/trunk/sapi/fpm/fpm/fastcgi.c2011-07-17 23:33:22 UTC (rev 313347) @@ -28,11 +28,7 @@ #include errno.h #include limits.h -#ifdef FPM_AUTOCONFIG_H -#include fpm_autoconfig.h -#else #include php_config.h -#endif #include fpm/fpm.h #include fpm/fpm_request.h Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_config.h === --- php/php-src/trunk/sapi/fpm/fpm/fpm_config.h 2011-07-17 23:26:02 UTC (rev 313346) +++
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c branches/PHP_5_4/sapi/fpm/fpm/fastcgi.h branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c trunk/sapi/fpm/fpm/fastcgi.c trunk/sapi/fpm/fpm/fa
fat Mon, 18 Jul 2011 00:09:30 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313351 Log: - remove is_fastcgi because FPM is always fastcgi Changed paths: U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.h U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fastcgi.c U php/php-src/trunk/sapi/fpm/fpm/fastcgi.h U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c 2011-07-18 00:09:29 UTC (rev 313350) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.c 2011-07-18 00:09:30 UTC (rev 313351) @@ -141,7 +141,6 @@ static HashTable fcgi_mgmt_vars; static int is_initialized = 0; -static int is_fastcgi = 0; static int in_shutdown = 0; static in_addr_t *allowed_clients = NULL; @@ -203,9 +202,7 @@ return 0; } # endif - if ((GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) - (GetStdHandle(STD_ERROR_HANDLE) == INVALID_HANDLE_VALUE) - (GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE)) { + { char *str; DWORD pipe_mode = PIPE_READMODE_BYTE | PIPE_WAIT; HANDLE pipe = GetStdHandle(STD_INPUT_HANDLE); @@ -224,38 +221,16 @@ if (str != NULL) { fcgi_accept_mutex = (HANDLE) atoi(str); } - return is_fastcgi = 1; - } else { - return is_fastcgi = 0; + return 1; } #else - errno = 0; - if (getpeername(0, (struct sockaddr *)sa, len) != 0 errno == ENOTCONN) { - fcgi_setup_signals(); - return is_fastcgi = 1; - } else { - return is_fastcgi = 0; - } + fcgi_setup_signals(); + return 1; #endif } - return is_fastcgi; + return 1; } - -int fcgi_is_fastcgi(void) -{ - if (!is_initialized) { - return fcgi_init(); - } else { - return is_fastcgi; - } -} - -void fcgi_set_is_fastcgi(int new_value) -{ - is_fastcgi = new_value; -} - void fcgi_set_in_shutdown(int new_value) { in_shutdown = new_value; @@ -266,7 +241,6 @@ if (is_initialized) { zend_hash_destroy(fcgi_mgmt_vars); } - is_fastcgi = 0; if (allowed_clients) { free(allowed_clients); } Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.h === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.h 2011-07-18 00:09:29 UTC (rev 313350) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fastcgi.h 2011-07-18 00:09:30 UTC (rev 313351) @@ -114,12 +114,10 @@ int fcgi_init(void); void fcgi_shutdown(void); -int fcgi_is_fastcgi(void); void fcgi_init_request(fcgi_request *req, int listen_socket); int fcgi_accept_request(fcgi_request *req); int fcgi_finish_request(fcgi_request *req, int force_close); -void fcgi_set_is_fastcgi(int new_value); void fcgi_set_in_shutdown(int); void fcgi_set_allowed_clients(char *); void fcgi_close(fcgi_request *req, int force, int destroy); Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c 2011-07-18 00:09:29 UTC (rev 313350) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c 2011-07-18 00:09:30 UTC (rev 313351) @@ -106,6 +106,7 @@ #include fpm/fpm_conf.h #include fpm/fpm_php.h #include fpm/fpm_log.h +#include fpm/zlog.h #ifndef PHP_WIN32 /* XXX this will need to change later when threaded fastcgi is implemented. shane */ @@ -260,35 +261,16 @@ zend_llist_destroy(sorted_exts); } -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 -#endif - static inline size_t sapi_cgibin_single_write(const char *str, uint str_length TSRMLS_DC) { -#ifdef PHP_WRITE_STDOUT long ret; -#else - size_t ret; -#endif - if (fcgi_is_fastcgi()) { - fcgi_request *request = (fcgi_request*) SG(server_context); - long ret = fcgi_write(request, FCGI_STDOUT, str, str_length); - if (ret = 0) { - return 0; - } - return ret; + fcgi_request *request = (fcgi_request*) SG(server_context); + ret = fcgi_write(request, FCGI_STDOUT, str, str_length); + if (ret = 0) { + return 0; } - -#ifdef PHP_WRITE_STDOUT - ret = write(STDOUT_FILENO, str, str_length); - if (ret = 0) return 0; return ret; -#else - ret = fwrite(str, 1, MIN(str_length, 16384), stdout); - return ret; -#endif } static int sapi_cgibin_ub_write(const char *str, uint str_length TSRMLS_DC) @@ -313,18 +295,12 @@ static void sapi_cgibin_flush(void *server_context) { - if (fcgi_is_fastcgi()) { - fcgi_request *request = (fcgi_request*) server_context; - if ( + fcgi_request *request = (fcgi_request*) server_context; + if ( #ifndef PHP_WIN32 - !parent + !parent #endif - request !fcgi_flush(request, 0)) { - php_handle_aborted_connection(); - } - return; - } - if (fflush(stdout) == EOF) { + request !fcgi_flush(request, 0)) {