fat Mon, 11 Jan 2010 17:57:22 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=293414
Log: INSTALL_ROOT was not set correctly for fpm binary Changed paths: U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/Makefile.frag U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/Makefile.frag =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/Makefile.frag 2010-01-11 17:08:53 UTC (rev 293413) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/Makefile.frag 2010-01-11 17:57:22 UTC (rev 293414) @@ -12,7 +12,7 @@ @$(mkinstalldirs) $(INSTALL_ROOT)$(sbindir) @$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/log @$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/run - @$(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROO)$(sbindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT) + @$(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROOT)$(sbindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT) @echo "Installing PHP FPM config: $(INSTALL_ROOT)$(sysconfdir)/" && \ $(mkinstalldirs) $(INSTALL_ROOT)$(sysconfdir) || : Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c 2010-01-11 17:08:53 UTC (rev 293413) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c 2010-01-11 17:57:22 UTC (rev 293414) @@ -297,6 +297,8 @@ free(wpc->pm->status); free(wpc->pm->ping); free(wpc->pm->pong); + free(wpc->sticky_cookie); + free(wpc->sticky_route); if (wpc->listen_options) { free(wpc->listen_options->owner); free(wpc->listen_options->group); @@ -347,6 +349,9 @@ { XML_CONF_SCALAR, "rlimit_files", &xml_conf_set_slot_integer, offsetof(struct fpm_worker_pool_config_s, rlimit_files) }, { XML_CONF_SCALAR, "rlimit_core", &fpm_conf_set_rlimit_core, 0 }, { XML_CONF_SCALAR, "max_requests", &xml_conf_set_slot_integer, offsetof(struct fpm_worker_pool_config_s, max_requests) }, + { XML_CONF_SCALAR, "sticky", &xml_conf_set_slot_boolean, offsetof(struct fpm_worker_pool_config_s, sticky) }, + { XML_CONF_SCALAR, "sticky_cookie", &xml_conf_set_slot_string, offsetof(struct fpm_worker_pool_config_s, sticky_cookie) }, + { XML_CONF_SCALAR, "sticky_route", &xml_conf_set_slot_string, offsetof(struct fpm_worker_pool_config_s, sticky_route) }, { XML_CONF_SCALAR, "catch_workers_output", &fpm_conf_set_catch_workers_output, 0 }, { XML_CONF_SUBSECTION, "pm", &fpm_conf_set_pm_subsection, offsetof(struct fpm_worker_pool_config_s, pm) }, { 0, 0, 0, 0 } @@ -475,7 +480,65 @@ close(fd); } } + if (wp->config->sticky) { + char *cookie = wp->config->sticky_cookie; + char *route = wp->config->sticky_route; + int i; + if (!cookie) { + wp->config->sticky_cookie = strdup("FPMCOOKIE"); + } else { + if (strlen(cookie) < 2) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky cookie '%s' is not long enough", wp->config->name, cookie); + return(-1); + } + + for (i=0; i<strlen(cookie); i++) { + if (!isalnum(cookie[i])) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky cookie '%s' must containt only the alphanum characters", wp->config->name, cookie); + return(-1); + } + } + } + + if (!route) { + char *hostname; + hostname = malloc(sizeof(char) * (FPM_CONF_MAX_HOSTNAME_LENGTH + 1)); + if (!hostname) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] sticky: unable to malloc memory for hostname", wp->config->name); + return(-1); + } + if (gethostname(hostname, FPM_CONF_MAX_HOSTNAME_LENGTH) != 0) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] sticky: unable to retrieve hostname", wp->config->name); + return(-1); + } + hostname[FPM_CONF_MAX_HOSTNAME_LENGTH] = '\0'; + wp->config->sticky_route = strdup(hostname); + zlog(ZLOG_STUFF, ZLOG_NOTICE, "[pool %s] the sticky route has been set to the local hostname '%s'", wp->config->name, wp->config->sticky_route); + free(hostname); + } else { + if (strlen(route) < 2) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky route '%s' is not long enough", wp->config->name, route); + return(-1); + } + + for (i=0; i<strlen(route); i++) { + if (!isalnum(route[i])) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the sticky route '%s' must containt only the alphanum characters", wp->config->name, route); + return(-1); + } + } + } +zlog(ZLOG_STUFF, ZLOG_NOTICE, "[pool %s] sticky is set to %s=%s", wp->config->name, wp->config->sticky_cookie, wp->config->sticky_route); + } else { + if (wp->config->sticky_route) { + free(wp->config->sticky_route); + } + if (wp->config->sticky_cookie) { + free(wp->config->sticky_cookie); + } + } + if (wp->config->pm->ping && *wp->config->pm->ping) { char *ping = wp->config->pm->ping; int i; Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h 2010-01-11 17:08:53 UTC (rev 293413) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h 2010-01-11 17:57:22 UTC (rev 293414) @@ -6,6 +6,7 @@ #define FPM_CONF_H 1 #define FPM_CONF_MAX_PONG_LENGTH 64 +#define FPM_CONF_MAX_HOSTNAME_LENGTH 255 struct key_value_s; @@ -64,6 +65,9 @@ int max_requests; int rlimit_files; int rlimit_core; + int sticky; + char *sticky_cookie; + char *sticky_route; unsigned catch_workers_output:1; };
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php