From 5def82fa6356a60d6960c753aed8f7b2dec1a991 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 29 Jan 2016 11:44:01 +0100 Subject: php-fpm: test build for https://bugs.php.net/62172 --- php-bug62172.patch | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ php56.spec | 7 ++++++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 php-bug62172.patch diff --git a/php-bug62172.patch b/php-bug62172.patch new file mode 100644 index 0000000..81ccc35 --- /dev/null +++ b/php-bug62172.patch @@ -0,0 +1,59 @@ +From 07d2dcdf09fcfbd617031bd341384efb236de12c Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 29 Jan 2016 10:20:42 +0100 +Subject: [PATCH] Fixed Bug #62172 FPM not working with Apache httpd 2.4 + balancer/fcgi setup + +Only needed with Apache version < 2.4.12 (ex RHEL-7) +--- + sapi/fpm/fpm/fpm_main.c | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c +index f3c8ccc..d12ac01 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -1108,11 +1108,14 @@ static void init_request_info(TSRMLS_D) + } + + #define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://" +- /* Fix proxy URLs in SCRIPT_FILENAME generated by Apache mod_proxy_fcgi: ++#define APACHE_PROXY_BALANCER_PREFIX "proxy:balancer://" ++ /* Fix proxy URLs in SCRIPT_FILENAME generated by Apache mod_proxy_fcgi and mod_proxy_balancer: + * proxy:fcgi://localhost:9000/some-dir/info.php/test?foo=bar ++ * proxy:balancer://localhost:9000/some-dir/info.php/test?foo=bar + * should be changed to: + * /some-dir/info.php/test + * See: http://bugs.php.net/bug.php?id=54152 ++ * http://bugs.php.net/bug.php?id=62172 + * https://issues.apache.org/bugzilla/show_bug.cgi?id=50851 + */ + if (env_script_filename && +@@ -1136,6 +1139,27 @@ static void init_request_info(TSRMLS_D) + } + } + ++ if (env_script_filename && ++ strncasecmp(env_script_filename, APACHE_PROXY_BALANCER_PREFIX, sizeof(APACHE_PROXY_BALANCER_PREFIX) - 1) == 0) { ++ /* advance to first character of hostname */ ++ char *p = env_script_filename + (sizeof(APACHE_PROXY_BALANCER_PREFIX) - 1); ++ while (*p != '\0' && *p != '/') { ++ p++; /* move past hostname and port */ ++ } ++ if (*p != '\0') { ++ /* Copy path portion in place to avoid memory leak. Note ++ * that this also affects what script_path_translated points ++ * to. */ ++ memmove(env_script_filename, p, strlen(p) + 1); ++ apache_was_here = 1; ++ } ++ /* ignore query string if sent by Apache (RewriteRule) */ ++ p = strchr(env_script_filename, '?'); ++ if (p) { ++ *p =0; ++ } ++ } ++ + if (CGIG(fix_pathinfo)) { + struct stat st; + char *real_path = NULL; diff --git a/php56.spec b/php56.spec index 1b12c5b..0b81f73 100644 --- a/php56.spec +++ b/php56.spec @@ -148,7 +148,7 @@ Version: 5.6.17 %if 0%{?snapdate:1}%{?rcver:1} Release: 0.1.%{?snapdate}%{?rcver}%{?dist} %else -Release: 1%{?dist} +Release: 2%{?dist} %endif # All files licensed under PHP version 3.01, except # Zend is licensed under Zend @@ -221,6 +221,7 @@ Patch300: php-5.6.3-datetests.patch Patch301: php-5.6.0-oldpcre.patch # WIP +Patch401: php-bug62172.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -990,6 +991,7 @@ rm -rf ext/json %endif # WIP patch +%patch401 -p1 -b .bug62172 # Prevent %%doc confusion over LICENSE files cp Zend/LICENSE Zend/ZEND_LICENSE @@ -1988,6 +1990,9 @@ fi %changelog +* Fri Jan 29 2016 Remi Collet 5.6.17-2 +- FPM: test build for https://bugs.php.net/62172 + * Wed Jan 6 2016 Remi Collet 5.6.17-1 - Update to 5.6.17 http://www.php.net/releases/5_6_17.php -- cgit