summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-11-22 20:23:43 +0300
committerValentin Bartenev <vbart@nginx.com>2018-11-22 20:23:43 +0300
commit262578dc71e4c1aaad01656a9b0c78539b1e7371 (patch)
tree0b2046f05e0fe1aa2e182ce3632e9414a2fa807f /src/nxt_php_sapi.c
parentadf22b6a0d3481f7fc4d38ade08a2a0dd4ea6f19 (diff)
downloadunit-262578dc71e4c1aaad01656a9b0c78539b1e7371.tar.gz
unit-262578dc71e4c1aaad01656a9b0c78539b1e7371.tar.bz2
PHP: workaround for bug #71041.
Since PHP 7, a zend_signal_startup() call is required if the interpreter was built with ZEND_SIGNALS defined; such a call was added in 3fd76e4ce70a. However, the zend_signal_startup() export is missing from the PHP library; as the result, dlopen() fails with the 'Undefined symbol "zend_signal_startup"' error while loading the PHP module. Meanwhile, if PHP is built without ZTS, the zend_signal_startup() call can be omitted; otherwise, the missing call causes segmentation fault. The PHP fix already was committed to upstream, but we still have to deal with numerous unpatched versions remaining at large. See the related PHP bug: https://bugs.php.net/bug.php?id=71041
Diffstat (limited to 'src/nxt_php_sapi.c')
-rw-r--r--src/nxt_php_sapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index fbddd779..47b5ff04 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -270,10 +270,14 @@ nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
tsrm_ls = ts_resource(0);
#endif
-#ifdef NXT_PHP7
-#if defined(ZEND_SIGNALS) || PHP_MINOR_VERSION > 0
+#if defined(NXT_PHP7) && defined(ZEND_SIGNALS)
+
+#if (NXT_ZEND_SIGNAL_STARTUP)
zend_signal_startup();
+#elif defined(ZTS)
+#error PHP is built with thread safety and broken signals.
#endif
+
#endif
sapi_startup(&nxt_php_sapi_module);