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)
This commit is contained in:
Remi Collet 2016-01-29 10:20:42 +01:00
parent 8ee1ae9748
commit 07d2dcdf09

View file

@ -1108,11 +1108,14 @@ static void init_request_info(TSRMLS_D)
} }
#define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://" #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: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: * should be changed to:
* /some-dir/info.php/test * /some-dir/info.php/test
* See: http://bugs.php.net/bug.php?id=54152 * 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 * https://issues.apache.org/bugzilla/show_bug.cgi?id=50851
*/ */
if (env_script_filename && 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)) { if (CGIG(fix_pathinfo)) {
struct stat st; struct stat st;
char *real_path = NULL; char *real_path = NULL;