summaryrefslogtreecommitdiff
path: root/sapi/cgi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cgi')
-rw-r--r--sapi/cgi/cgi_main.c9
-rw-r--r--sapi/cgi/config.w322
-rw-r--r--sapi/cgi/config9.m42
3 files changed, 10 insertions, 3 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 1bef17c257..94f35a6c83 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -198,7 +198,10 @@ static void user_config_cache_entry_dtor(zval *el)
#ifdef ZTS
static int php_cgi_globals_id;
-#define CGIG(v) TSRMG(php_cgi_globals_id, php_cgi_globals_struct *, v)
+#define CGIG(v) ZEND_TSRMG(php_cgi_globals_id, php_cgi_globals_struct *, v)
+#if defined(PHP_WIN32)
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
#else
static php_cgi_globals_struct php_cgi_globals;
#define CGIG(v) (php_cgi_globals.v)
@@ -1482,6 +1485,9 @@ PHP_INI_END()
*/
static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals TSRMLS_DC)
{
+#ifdef ZTS
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
php_cgi_globals->rfc2616_headers = 0;
php_cgi_globals->nph = 0;
php_cgi_globals->check_shebang_line = 1;
@@ -1809,6 +1815,7 @@ int main(int argc, char *argv[])
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
tsrm_ls = ts_resource(0);
+ ZEND_TSRMLS_CACHE_UPDATE;
#endif
sapi_startup(&cgi_sapi_module);
diff --git a/sapi/cgi/config.w32 b/sapi/cgi/config.w32
index 55a2fba48f..daf4f05687 100644
--- a/sapi/cgi/config.w32
+++ b/sapi/cgi/config.w32
@@ -5,6 +5,6 @@ ARG_ENABLE('cgi', 'Build CGI version of PHP', 'yes');
if (PHP_CGI == "yes") {
ADD_FLAG("LDFLAGS_CGI", "/stack:67108864");
- SAPI('cgi', 'cgi_main.c fastcgi.c', 'php-cgi.exe');
+ SAPI('cgi', 'cgi_main.c fastcgi.c', 'php-cgi.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_FLAG('LIBS_CGI', 'ws2_32.lib kernel32.lib advapi32.lib');
}
diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4
index 49e61c83c3..a005f8e0ad 100644
--- a/sapi/cgi/config9.m4
+++ b/sapi/cgi/config9.m4
@@ -50,7 +50,7 @@ if test "$PHP_CGI" != "no"; then
esac
dnl Select SAPI
- PHP_SELECT_SAPI(cgi, program, cgi_main.c fastcgi.c,, '$(SAPI_CGI_PATH)')
+ PHP_SELECT_SAPI(cgi, program, cgi_main.c fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, '$(SAPI_CGI_PATH)')
case $host_alias in
*aix*)