-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit 1.6 FreeBSD: configure script failes to detect 'embed' when PHP built with ZTS=on #184
Comments
Please try the following patch: # HG changeset patch
# User Valentin Bartenev <vbart@nginx.com>
# Date 1542651747 -10800
# Mon Nov 19 21:22:27 2018 +0300
# Node ID ea6d58aea6f59d23c53f90c98d29424aa635aed0
# Parent cb3595d839665885cc83c6a20c84ae4ee1e0b5da
PHP: fixed compatibility with ZTS.
This closes #184 issue on GitHub.
diff -r cb3595d83966 -r ea6d58aea6f5 auto/modules/php
--- a/auto/modules/php Thu Nov 15 21:50:00 2018 +0300
+++ b/auto/modules/php Mon Nov 19 21:22:27 2018 +0300
@@ -111,7 +111,7 @@ if /bin/sh -c "${NXT_PHP_CONFIG} --versi
#include <php_main.h>
int main() {
- php_request_startup();
+ php_module_startup(NULL, NULL, 0);
return 0;
}"
diff -r cb3595d83966 -r ea6d58aea6f5 src/nxt_php_sapi.c
--- a/src/nxt_php_sapi.c Thu Nov 15 21:50:00 2018 +0300
+++ b/src/nxt_php_sapi.c Mon Nov 19 21:22:27 2018 +0300
@@ -45,19 +45,19 @@ static void nxt_php_set_options(nxt_task
int type);
static nxt_int_t nxt_php_alter_option(nxt_str_t *name, nxt_str_t *value,
int type);
-static int nxt_php_send_headers(sapi_headers_struct *sapi_headers);
-static char *nxt_php_read_cookies(void);
+static int nxt_php_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC);
+static char *nxt_php_read_cookies(TSRMLS_D);
static void nxt_php_set_sptr(nxt_unit_request_info_t *req, const char *name,
nxt_unit_sptr_t *v, uint32_t len, zval *track_vars_array TSRMLS_DC);
nxt_inline void nxt_php_set_str(nxt_unit_request_info_t *req, const char *name,
nxt_str_t *s, zval *track_vars_array TSRMLS_DC);
static void nxt_php_set_cstr(nxt_unit_request_info_t *req, const char *name,
char *str, uint32_t len, zval *track_vars_array TSRMLS_DC);
-static void nxt_php_register_variables(zval *track_vars_array);
+static void nxt_php_register_variables(zval *track_vars_array TSRMLS_DC);
#ifdef NXT_HAVE_PHP_LOG_MESSAGE_WITH_SYSLOG_TYPE
static void nxt_php_log_message(char *message, int syslog_type_int);
#else
-static void nxt_php_log_message(char *message);
+static void nxt_php_log_message(char *message TSRMLS_DC);
#endif
#ifdef NXT_PHP7
@@ -159,6 +159,9 @@ NXT_EXPORT nxt_app_module_t nxt_app_mod
static nxt_task_t *nxt_php_task;
+#ifdef ZTS
+static void ***tsrm_ls;
+#endif
static nxt_int_t
@@ -262,6 +265,17 @@ nxt_php_init(nxt_task_t *task, nxt_commo
nxt_memcpy(index->start, c->index.start, c->index.length);
}
+#ifdef ZTS
+ tsrm_startup(1, 1, 0, NULL);
+ tsrm_ls = ts_resource(0);
+#endif
+
+#ifdef NXT_PHP7
+#if defined(ZEND_SIGNALS) || PHP_MINOR_VERSION > 0
+ zend_signal_startup();
+#endif
+#endif
+
sapi_startup(&nxt_php_sapi_module);
if (c->options != NULL) {
@@ -433,7 +447,8 @@ nxt_php_alter_option(nxt_str_t *name, nx
if (ini_entry->on_modify
&& ini_entry->on_modify(ini_entry, cstr, value->length,
ini_entry->mh_arg1, ini_entry->mh_arg2,
- ini_entry->mh_arg3, ZEND_INI_STAGE_ACTIVATE)
+ ini_entry->mh_arg3, ZEND_INI_STAGE_ACTIVATE
+ TSRMLS_CC)
!= SUCCESS)
{
nxt_free(cstr);
@@ -573,7 +588,11 @@ nxt_php_request_handler(nxt_unit_request
(char *) ctx->script.start);
}
+#if (NXT_PHP7)
if (nxt_slow_path(php_request_startup() == FAILURE)) {
+#else
+ if (nxt_slow_path(php_request_startup(TSRMLS_C) == FAILURE)) {
+#endif
nxt_unit_req_debug(req, "php_request_startup() failed");
rc = NXT_UNIT_ERROR;
@@ -915,7 +934,7 @@ static void
nxt_php_log_message(char *message, int syslog_type_int)
#else
static void
-nxt_php_log_message(char *message)
+nxt_php_log_message(char *message TSRMLS_DC)
#endif
{
nxt_log(nxt_php_task, NXT_LOG_NOTICE, "php message: %s", message);
|
Works! Thank you. |
the ZTS option. Bump PORTREVISION. PR: 233255 Patch: nginx/unit#184 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@485364 35697150-7ecd-e111-bb59-0022644237b5
the ZTS option. Bump PORTREVISION. PR: 233255 Patch: nginx/unit#184 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@485364 35697150-7ecd-e111-bb59-0022644237b5
the ZTS option. Bump PORTREVISION. PR: 233255 Patch: nginx/unit#184
the ZTS option. Bump PORTREVISION. PR: 233255 Patch: nginx/unit#184 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@485364 35697150-7ecd-e111-bb59-0022644237b5
This closes #184 issue on GitHub.
This patch breaks my unit-php module on FreeBSD. I've reported it here (including error from the log): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233349 |
@RvdE This is due to the bug in PHP. I've made a pull request: php/php-src#3670 |
I'm working on a workaround for this bug in Unit, but it would be nice if the fix (php/php-src@11ddf76) will be added to PHP port in FreeBSD. Anyway it is fixed in upcoming PHP 7.1.25. |
Thank you. I've applied the patch to the freebsd PHP port and everything works fine now with the ZTS compat. patch |
I've committed a workaround for Unit module: 262578d so now it should work with unpatched versions of PHP 7.1+ (unless both ZTS and signals are enabled). |
Hello,
Details: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233255
The text was updated successfully, but these errors were encountered: