@@ -45,19 +45,19 @@ static void nxt_php_set_options(nxt_task_t *task, nxt_conf_value_t *options,
45
45
int type );
46
46
static nxt_int_t nxt_php_alter_option (nxt_str_t * name , nxt_str_t * value ,
47
47
int type );
48
- static int nxt_php_send_headers (sapi_headers_struct * sapi_headers );
49
- static char * nxt_php_read_cookies (void );
48
+ static int nxt_php_send_headers (sapi_headers_struct * sapi_headers TSRMLS_DC );
49
+ static char * nxt_php_read_cookies (TSRMLS_D );
50
50
static void nxt_php_set_sptr (nxt_unit_request_info_t * req , const char * name ,
51
51
nxt_unit_sptr_t * v , uint32_t len , zval * track_vars_array TSRMLS_DC );
52
52
nxt_inline void nxt_php_set_str (nxt_unit_request_info_t * req , const char * name ,
53
53
nxt_str_t * s , zval * track_vars_array TSRMLS_DC );
54
54
static void nxt_php_set_cstr (nxt_unit_request_info_t * req , const char * name ,
55
55
char * str , uint32_t len , zval * track_vars_array TSRMLS_DC );
56
- static void nxt_php_register_variables (zval * track_vars_array );
56
+ static void nxt_php_register_variables (zval * track_vars_array TSRMLS_DC );
57
57
#ifdef NXT_HAVE_PHP_LOG_MESSAGE_WITH_SYSLOG_TYPE
58
58
static void nxt_php_log_message (char * message , int syslog_type_int );
59
59
#else
60
- static void nxt_php_log_message (char * message );
60
+ static void nxt_php_log_message (char * message TSRMLS_DC );
61
61
#endif
62
62
63
63
#ifdef NXT_PHP7
@@ -159,6 +159,9 @@ NXT_EXPORT nxt_app_module_t nxt_app_module = {
159
159
160
160
161
161
static nxt_task_t * nxt_php_task ;
162
+ #ifdef ZTS
163
+ static void * * * tsrm_ls ;
164
+ #endif
162
165
163
166
164
167
static nxt_int_t
@@ -262,6 +265,17 @@ nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
262
265
nxt_memcpy (index -> start , c -> index .start , c -> index .length );
263
266
}
264
267
268
+ #ifdef ZTS
269
+ tsrm_startup (1 , 1 , 0 , NULL );
270
+ tsrm_ls = ts_resource (0 );
271
+ #endif
272
+
273
+ #ifdef NXT_PHP7
274
+ #if defined(ZEND_SIGNALS ) || PHP_MINOR_VERSION > 0
275
+ zend_signal_startup ();
276
+ #endif
277
+ #endif
278
+
265
279
sapi_startup (& nxt_php_sapi_module );
266
280
267
281
if (c -> options != NULL ) {
@@ -433,7 +447,8 @@ nxt_php_alter_option(nxt_str_t *name, nxt_str_t *value, int type)
433
447
if (ini_entry -> on_modify
434
448
&& ini_entry -> on_modify (ini_entry , cstr , value -> length ,
435
449
ini_entry -> mh_arg1 , ini_entry -> mh_arg2 ,
436
- ini_entry -> mh_arg3 , ZEND_INI_STAGE_ACTIVATE )
450
+ ini_entry -> mh_arg3 , ZEND_INI_STAGE_ACTIVATE
451
+ TSRMLS_CC )
437
452
!= SUCCESS )
438
453
{
439
454
nxt_free (cstr );
@@ -573,7 +588,11 @@ nxt_php_request_handler(nxt_unit_request_info_t *req)
573
588
(char * ) ctx -> script .start );
574
589
}
575
590
591
+ #if (NXT_PHP7 )
576
592
if (nxt_slow_path (php_request_startup () == FAILURE )) {
593
+ #else
594
+ if (nxt_slow_path (php_request_startup (TSRMLS_C ) == FAILURE )) {
595
+ #endif
577
596
nxt_unit_req_debug (req , "php_request_startup() failed" );
578
597
rc = NXT_UNIT_ERROR ;
579
598
@@ -915,7 +934,7 @@ static void
915
934
nxt_php_log_message (char * message , int syslog_type_int )
916
935
#else
917
936
static void
918
- nxt_php_log_message (char * message )
937
+ nxt_php_log_message (char * message TSRMLS_DC )
919
938
#endif
920
939
{
921
940
nxt_log (nxt_php_task , NXT_LOG_NOTICE , "php message: %s" , message );
0 commit comments