|
|
8d87dc |
From ee275e34c8b303945945c650d4bc90dcc2ac0b17 Mon Sep 17 00:00:00 2001
|
|
|
8d87dc |
From: David Zuelke <dzuelke@gmail.com>
|
|
|
8d87dc |
Date: Sat, 9 Aug 2014 08:26:33 +0200
|
|
|
8d87dc |
Subject: [PATCH] restore FPM compatibility with mod_fastcgi broken since #694
|
|
|
8d87dc |
/ 67541, fixes bug 67606
|
|
|
8d87dc |
|
|
|
8d87dc |
---
|
|
|
8d87dc |
sapi/fpm/fpm/fpm_main.c | 11 ++++++++---
|
|
|
8d87dc |
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
8d87dc |
|
|
|
8d87dc |
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
|
|
|
8d87dc |
index e879325..56a06f9 100644
|
|
|
8d87dc |
--- a/sapi/fpm/fpm/fpm_main.c
|
|
|
8d87dc |
+++ b/sapi/fpm/fpm/fpm_main.c
|
|
|
8d87dc |
@@ -1142,13 +1142,16 @@ static void init_request_info(TSRMLS_D)
|
|
|
8d87dc |
TRANSLATE_SLASHES(env_document_root);
|
|
|
8d87dc |
}
|
|
|
8d87dc |
|
|
|
8d87dc |
- if (env_path_translated != NULL && env_redirect_url != NULL &&
|
|
|
8d87dc |
+ if (!apache_was_here && env_path_translated != NULL && env_redirect_url != NULL &&
|
|
|
8d87dc |
env_path_translated != script_path_translated &&
|
|
|
8d87dc |
strcmp(env_path_translated, script_path_translated) != 0) {
|
|
|
8d87dc |
/*
|
|
|
8d87dc |
* pretty much apache specific. If we have a redirect_url
|
|
|
8d87dc |
* then our script_filename and script_name point to the
|
|
|
8d87dc |
* php executable
|
|
|
8d87dc |
+ * we don't want to do this for the new mod_proxy_fcgi approach,
|
|
|
8d87dc |
+ * where redirect_url may also exist but the below will break
|
|
|
8d87dc |
+ * with rewrites to PATH_INFO, hence the !apache_was_here check
|
|
|
8d87dc |
*/
|
|
|
8d87dc |
script_path_translated = env_path_translated;
|
|
|
8d87dc |
/* we correct SCRIPT_NAME now in case we don't have PATH_INFO */
|
|
|
8d87dc |
@@ -1323,7 +1326,7 @@ static void init_request_info(TSRMLS_D)
|
|
|
8d87dc |
efree(pt);
|
|
|
8d87dc |
}
|
|
|
8d87dc |
} else {
|
|
|
8d87dc |
- /* make sure path_info/translated are empty */
|
|
|
8d87dc |
+ /* make sure original values are remembered in ORIG_ copies if we've changed them */
|
|
|
8d87dc |
if (!orig_script_filename ||
|
|
|
8d87dc |
(script_path_translated != orig_script_filename &&
|
|
|
8d87dc |
strcmp(script_path_translated, orig_script_filename) != 0)) {
|
|
|
8d87dc |
@@ -1332,7 +1335,9 @@ static void init_request_info(TSRMLS_D)
|
|
|
8d87dc |
}
|
|
|
8d87dc |
script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", script_path_translated TSRMLS_CC);
|
|
|
8d87dc |
}
|
|
|
8d87dc |
- if (env_redirect_url) {
|
|
|
8d87dc |
+ if (!apache_was_here && env_redirect_url) {
|
|
|
8d87dc |
+ /* if we used PATH_TRANSLATED to work around Apache mod_fastcgi (but not mod_proxy_fcgi,
|
|
|
8d87dc |
+ * hence !apache_was_here) weirdness, strip info accordingly */
|
|
|
8d87dc |
if (orig_path_info) {
|
|
|
8d87dc |
_sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC);
|
|
|
8d87dc |
_sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);
|
|
|
8d87dc |
--
|
|
|
8d87dc |
2.1.4
|
|
|
8d87dc |
|
|
|
8d87dc |
From 8cac75969e5abb2b6be5bbd489d851a4f9e50979 Mon Sep 17 00:00:00 2001
|
|
|
8d87dc |
From: Remi Collet <remi@php.net>
|
|
|
8d87dc |
Date: Mon, 15 Sep 2014 13:29:55 +0200
|
|
|
8d87dc |
Subject: [PATCH] Fixed bug #65641 PHP-FPM incorrectly defines the SCRIPT_NAME
|
|
|
8d87dc |
variable when using Apache
|
|
|
8d87dc |
|
|
|
8d87dc |
ProxyPass is unable to provide correct PATH_INFO
|
|
|
8d87dc |
as it is not aware of file path (while SetHandler is).
|
|
|
8d87dc |
|
|
|
8d87dc |
As we can extract PATH_INFO from PATH_TRANSLATED,
|
|
|
8d87dc |
we also need to check if present in SCRIPT_NAME
|
|
|
8d87dc |
and remove it.
|
|
|
8d87dc |
|
|
|
8d87dc |
After applying this patch.
|
|
|
8d87dc |
With mod_php
|
|
|
8d87dc |
_SERVER["REQUEST_URI"] /info.php/foo/bar?q=1
|
|
|
8d87dc |
_SERVER["SCRIPT_NAME"] /info.php
|
|
|
8d87dc |
_SERVER["PATH_INFO"] /foor/bar
|
|
|
8d87dc |
_SERVER["PHP_SELF"] /info.php/foo/bar
|
|
|
8d87dc |
_SERVER["QUERY_STRING"] q=1
|
|
|
8d87dc |
|
|
|
8d87dc |
With mod_proxy_fcgi + SetHandler
|
|
|
8d87dc |
_SERVER["REQUEST_URI"] /info.php/foo/bar?q=1
|
|
|
8d87dc |
_SERVER["SCRIPT_NAME"] /info.php
|
|
|
8d87dc |
_SERVER["PATH_INFO"] /foo/bar
|
|
|
8d87dc |
_SERVER["PHP_SELF"] /info.php/foo/bar
|
|
|
8d87dc |
_SERVER["QUERY_STRING"] q=1
|
|
|
8d87dc |
|
|
|
8d87dc |
With mod_proxy_fcgi + ProxyPass
|
|
|
8d87dc |
_SERVER["REQUEST_URI"] /info.php/foo/bar?q=1
|
|
|
8d87dc |
_SERVER["SCRIPT_NAME"] /info.php
|
|
|
8d87dc |
_SERVER["PATH_INFO"] /foo/bar
|
|
|
8d87dc |
_SERVER["PHP_SELF"] /info.php/foo/bar
|
|
|
8d87dc |
_SERVER["QUERY_STRING"] q=1
|
|
|
8d87dc |
---
|
|
|
8d87dc |
sapi/fpm/fpm/fpm_main.c | 11 +++++++++++
|
|
|
8d87dc |
1 file changed, 11 insertions(+)
|
|
|
8d87dc |
|
|
|
8d87dc |
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
|
|
|
8d87dc |
index 56a06f9..331342c 100644
|
|
|
8d87dc |
--- a/sapi/fpm/fpm/fpm_main.c
|
|
|
8d87dc |
+++ b/sapi/fpm/fpm/fpm_main.c
|
|
|
8d87dc |
@@ -1231,6 +1231,17 @@ static void init_request_info(TSRMLS_D)
|
|
|
8d87dc |
SG(request_info).request_uri = orig_script_name;
|
|
|
8d87dc |
}
|
|
|
8d87dc |
path_info[0] = old;
|
|
|
8d87dc |
+ } else if (apache_was_here && env_script_name) {
|
|
|
8d87dc |
+ /* Using mod_proxy_fcgi and ProxyPass, apache cannot set PATH_INFO
|
|
|
8d87dc |
+ * As we can extract PATH_INFO from PATH_TRANSLATED
|
|
|
8d87dc |
+ * it is probably also in SCRIPT_NAME and need to be removed
|
|
|
8d87dc |
+ */
|
|
|
8d87dc |
+ int snlen = strlen(env_script_name);
|
|
|
8d87dc |
+ if (snlen>slen && !strcmp(env_script_name+snlen-slen, path_info)) {
|
|
|
8d87dc |
+ _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);
|
|
|
8d87dc |
+ env_script_name[snlen-slen] = 0;
|
|
|
8d87dc |
+ SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_script_name TSRMLS_CC);
|
|
|
8d87dc |
+ }
|
|
|
8d87dc |
}
|
|
|
8d87dc |
env_path_info = _sapi_cgibin_putenv("PATH_INFO", path_info TSRMLS_CC);
|
|
|
8d87dc |
}
|
|
|
8d87dc |
--
|
|
|
8d87dc |
2.1.4
|
|
|
8d87dc |
|