fat                                      Sat, 02 Jul 2011 23:41:01 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=312827

Log:
- Implemented FR #54172 (Overriding the pid file location of php-fpm)

Bug: https://bugs.php.net/54172 (Closed) Overriding the pid file location of 
php-fpm
      
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_main.c
    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_main.c
    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_main.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS	2011-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_3/NEWS	2011-07-02 23:41:01 UTC (rev 312827)
@@ -25,6 +25,7 @@
   . Fixed missing Expires and Cache-Control headers for ping and status pages.
     (fat)
   . Implemented FR #54499 (FPM ping and status_path should handle HEAD request). (fat)
+  . Implemented FR #54172 (Overriding the pid file location of php-fpm). (fat)

 - SPL extension:
   . Fixed bug #54971 (Wrong result when using iterator_to_array with use_keys

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-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -29,6 +29,7 @@
 		.argv = NULL,
 		.config = NULL,
 		.prefix = NULL,
+		.pid = NULL,
 		.running_children = 0,
 		.error_log_fd = 0,
 		.log_level = 0,
@@ -38,7 +39,7 @@
 		.test_successful = 0
 	};

-int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf) /* {{{ */
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */
 {
 	fpm_globals.argc = argc;
 	fpm_globals.argv = argv;
@@ -46,6 +47,7 @@
 		fpm_globals.config = strdup(config);
 	}
 	fpm_globals.prefix = prefix;
+	fpm_globals.pid = pid;

 	if (0 > fpm_php_init_main()            ||
 		0 > fpm_stdio_init_main()            ||

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-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h	2011-07-02 23:41:01 UTC (rev 312827)
@@ -8,7 +8,7 @@
 #include <unistd.h>

 int fpm_run(int *max_requests);
-int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf);
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf);

 struct fpm_globals_s {
 	pid_t parent_pid;
@@ -16,6 +16,7 @@
 	char **argv;
 	char *config;
 	char *prefix;
+	char *pid;
 	int running_children;
 	int error_log_fd;
 	int log_level;

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-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -1206,6 +1206,10 @@
 		}
 	}

+	if (fpm_globals.pid && *fpm_globals.pid) {
+		fpm_global_config.pid_file = strdup(fpm_globals.pid);
+	}
+
 	if (fpm_globals.config == NULL) {
 		char *tmp;


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-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -155,6 +155,7 @@
 	{'y', 1, "fpm-config"},
 	{'t', 0, "test"},
 	{'p', 1, "prefix"},
+	{'g', 1, "pid"},
 	{'-', 0, NULL} /* end of args */
 };

@@ -961,7 +962,7 @@
 		prog = "php";
 	}

-	php_printf(	"Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix> ] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
+	php_printf(	"Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
 				"  -c <path>|<file> Look for php.ini file in this directory\n"
 				"  -n               No php.ini file will be used\n"
 				"  -d foo[=bar]     Define INI entry foo with value 'bar'\n"
@@ -972,6 +973,8 @@
 				"  -v               Version number\n"
 				"  -p, --prefix <dir>\n"
 				"                   Specify alternative prefix path to FastCGI process manager (default: %s).\n"
+				"  -g, --pid <file>\n"
+				"                   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",
@@ -1587,6 +1590,7 @@
 	fcgi_request request;
 	char *fpm_config = NULL;
 	char *fpm_prefix = NULL;
+	char *fpm_pid = NULL;
 	int test_conf = 0;

 	fcgi_init();
@@ -1670,6 +1674,10 @@
 				fpm_prefix = php_optarg;
 				break;

+			case 'g':
+				fpm_pid = php_optarg;
+				break;
+
 			case 'e': /* enable extended info output */
 				CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
 				break;
@@ -1815,7 +1823,7 @@
 		}
 	}

-	if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, test_conf)) {
+	if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf)) {
 		return FAILURE;
 	}


Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.c	2011-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -29,6 +29,7 @@
 		.argv = NULL,
 		.config = NULL,
 		.prefix = NULL,
+		.pid = NULL,
 		.running_children = 0,
 		.error_log_fd = 0,
 		.log_level = 0,
@@ -38,7 +39,7 @@
 		.test_successful = 0
 	};

-int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf) /* {{{ */
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */
 {
 	fpm_globals.argc = argc;
 	fpm_globals.argv = argv;
@@ -46,6 +47,7 @@
 		fpm_globals.config = strdup(config);
 	}
 	fpm_globals.prefix = prefix;
+	fpm_globals.pid = pid;

 	if (0 > fpm_php_init_main()            ||
 		0 > fpm_stdio_init_main()            ||

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-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm.h	2011-07-02 23:41:01 UTC (rev 312827)
@@ -8,7 +8,7 @@
 #include <unistd.h>

 int fpm_run(int *max_requests);
-int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf);
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf);

 struct fpm_globals_s {
 	pid_t parent_pid;
@@ -16,6 +16,7 @@
 	char **argv;
 	char *config;
 	char *prefix;
+	char *pid;
 	int running_children;
 	int error_log_fd;
 	int log_level;

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.c	2011-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -1206,6 +1206,10 @@
 		}
 	}

+	if (fpm_globals.pid && *fpm_globals.pid) {
+		fpm_global_config.pid_file = strdup(fpm_globals.pid);
+	}
+
 	if (fpm_globals.config == NULL) {
 		char *tmp;


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-02 23:25:55 UTC (rev 312826)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -155,6 +155,7 @@
 	{'y', 1, "fpm-config"},
 	{'t', 0, "test"},
 	{'p', 1, "prefix"},
+	{'g', 1, "pid"},
 	{'-', 0, NULL} /* end of args */
 };

@@ -959,7 +960,7 @@
 		prog = "php";
 	}

-	php_printf(	"Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix> ] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
+	php_printf(	"Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
 				"  -c <path>|<file> Look for php.ini file in this directory\n"
 				"  -n               No php.ini file will be used\n"
 				"  -d foo[=bar]     Define INI entry foo with value 'bar'\n"
@@ -970,6 +971,8 @@
 				"  -v               Version number\n"
 				"  -p, --prefix <dir>\n"
 				"                   Specify alternative prefix path to FastCGI process manager (default: %s).\n"
+				"  -g, --pid <file>\n"
+				"                   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",
@@ -1585,6 +1588,7 @@
 	fcgi_request request;
 	char *fpm_config = NULL;
 	char *fpm_prefix = NULL;
+	char *fpm_pid = NULL;
 	int test_conf = 0;

 #ifdef HAVE_SIGNAL_H
@@ -1669,6 +1673,10 @@
 				fpm_prefix = php_optarg;
 				break;

+			case 'g':
+				fpm_pid = php_optarg;
+				break;
+
 			case 'e': /* enable extended info output */
 				CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
 				break;
@@ -1814,7 +1822,7 @@
 		}
 	}

-	if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, test_conf)) {
+	if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf)) {
 		return FAILURE;
 	}


Modified: php/php-src/trunk/sapi/fpm/fpm/fpm.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm.c	2011-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -29,6 +29,7 @@
 		.argv = NULL,
 		.config = NULL,
 		.prefix = NULL,
+		.pid = NULL,
 		.running_children = 0,
 		.error_log_fd = 0,
 		.log_level = 0,
@@ -38,7 +39,7 @@
 		.test_successful = 0
 	};

-int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf) /* {{{ */
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */
 {
 	fpm_globals.argc = argc;
 	fpm_globals.argv = argv;
@@ -46,6 +47,7 @@
 		fpm_globals.config = strdup(config);
 	}
 	fpm_globals.prefix = prefix;
+	fpm_globals.pid = pid;

 	if (0 > fpm_php_init_main()            ||
 		0 > fpm_stdio_init_main()            ||

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm.h
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm.h	2011-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm.h	2011-07-02 23:41:01 UTC (rev 312827)
@@ -8,7 +8,7 @@
 #include <unistd.h>

 int fpm_run(int *max_requests);
-int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf);
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf);

 struct fpm_globals_s {
 	pid_t parent_pid;
@@ -16,6 +16,7 @@
 	char **argv;
 	char *config;
 	char *prefix;
+	char *pid;
 	int running_children;
 	int error_log_fd;
 	int log_level;

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c	2011-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -1206,6 +1206,10 @@
 		}
 	}

+	if (fpm_globals.pid && *fpm_globals.pid) {
+		fpm_global_config.pid_file = strdup(fpm_globals.pid);
+	}
+
 	if (fpm_globals.config == NULL) {
 		char *tmp;


Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c	2011-07-02 23:25:55 UTC (rev 312826)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c	2011-07-02 23:41:01 UTC (rev 312827)
@@ -155,6 +155,7 @@
 	{'y', 1, "fpm-config"},
 	{'t', 0, "test"},
 	{'p', 1, "prefix"},
+	{'g', 1, "pid"},
 	{'-', 0, NULL} /* end of args */
 };

@@ -959,7 +960,7 @@
 		prog = "php";
 	}

-	php_printf(	"Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix> ] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
+	php_printf(	"Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
 				"  -c <path>|<file> Look for php.ini file in this directory\n"
 				"  -n               No php.ini file will be used\n"
 				"  -d foo[=bar]     Define INI entry foo with value 'bar'\n"
@@ -970,6 +971,8 @@
 				"  -v               Version number\n"
 				"  -p, --prefix <dir>\n"
 				"                   Specify alternative prefix path to FastCGI process manager (default: %s).\n"
+				"  -g, --pid <file>\n"
+				"                   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",
@@ -1585,6 +1588,7 @@
 	fcgi_request request;
 	char *fpm_config = NULL;
 	char *fpm_prefix = NULL;
+	char *fpm_pid = NULL;
 	int test_conf = 0;

 #ifdef HAVE_SIGNAL_H
@@ -1669,6 +1673,10 @@
 				fpm_prefix = php_optarg;
 				break;

+			case 'g':
+				fpm_pid = php_optarg;
+				break;
+
 			case 'e': /* enable extended info output */
 				CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
 				break;
@@ -1814,7 +1822,7 @@
 		}
 	}

-	if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, test_conf)) {
+	if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf)) {
 		return FAILURE;
 	}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to