Commit Graph

26 Commits

Author SHA1 Message Date
Valentin Bartenev afa2f86ecf PHP: added ZTS indication to ./configure output. 2020-03-04 15:24:27 +03:00
Valentin Bartenev 75cb2a947d PHP: rearranged feature checks in ./configure.
Now it prints version even if PHP was built without embed SAPI.
2020-03-04 15:24:27 +03:00
Tiago Natel de Moura f99d20ad39 PHP: optimization to avoid surplus chdir(2) calls.
For each request, the worker calls the php_execute_script function
from libphp that changes to the script directory before doing its
work and then restores the process directory before returning.  The
chdir(2) calls it performs are unnecessary in Unit design.  In simple
benchmarks, profiling shows that the chdir syscall code path (syscall,
FS walk, etc.) is where the CPU spends most of its time.

PHP SAPI semantics requires the script to be run from the script
directory.  In Unit's PHP implementation, we have two use cases:

- script
- arbitrary path

The "script" configuration doesn't have much need for a working
directory change: it can be changed once at module initialization.
The module needs to chdir again only if the user's PHP script also
calls chdir to switch to another directory during execution.

If "script" is not used in Unit configuration, we must ensure the
script is run from its directory (thus calling chdir before exec),
but there's no need to restore the working directory later.

Our implementation disables mandatory chdir calls with the SAPI
option SAPI_OPTION_NO_CHDIR, instead calling chdir only when needed.

To detect the user's calls to chdir, a simple "unit" extension is
added that hooks the built-in chdir() PHP call.
2020-03-03 14:38:08 +00:00
Max Romanov 9b4e45cafc Fixed "make tests" build without preceding "make".
Currently almost all Unit object files depends on generated nxt_version.h.
This patch adds missing dependence and fixes running make with multiple
jobs.

This closes #318 issue on GitHub.
2019-10-02 19:11:10 +03:00
Valentin Bartenev 262578dc71 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
2018-11-22 20:23:43 +03:00
Valentin Bartenev adf22b6a0d PHP: fixed compatibility with ZTS.
This closes #184 issue on GitHub.
2018-11-21 18:22:19 +03:00
Max Romanov 1bb22d1e92 Unit application library.
Library now used in all language modules.
Old 'nxt_app_*' code removed.

See src/test/nxt_unit_app_test.c for usage sample.
2018-08-06 17:27:33 +03:00
Igor Sysoev 61df281464 Added check of "make install" ability.
This closes #136 issue on GitHub.
2018-06-28 17:36:42 +03:00
Igor Sysoev e54fb892a4 PHP: fixed building on MacOSX with --ld-opt= option. 2018-05-30 18:31:26 +03:00
Max Romanov 38e40fa857 PHP: using generated dependencies in makefile. 2018-05-30 18:19:39 +03:00
Alexander Borisov 49bd3a21e0 Changed version processing for modules. 2018-04-04 18:53:39 +03:00
Igor Sysoev a35732bf05 PHP: "--lib-static" option uses "--lib-path" option. 2018-01-15 15:05:22 +03:00
Igor Sysoev c9ae198016 PHP: added "--lib-static" configure option.
The libraries returned by "php-config --libs" are required to link with
static libphp.a.  Dynamic libphp.so contains the required libraries names.
2018-01-12 18:15:58 +03:00
Max Romanov 630ec3f1ec Using compiler capability to generate dependencies.
This closes #58 issue on GitHub.
2017-12-01 16:28:06 +03:00
Max Romanov 1add36a7ee Using --ld-opt when linking modules. 2017-11-29 18:49:08 +03:00
Igor Sysoev 58907888e5 Style fixes. 2017-09-06 02:30:55 +03:00
Max Romanov ac7218e335 Introducing install & uninstall Makefile targets. 2017-08-31 11:42:13 -07:00
Igor Sysoev 738ca54ded Changed modules names format. 2017-08-31 00:42:16 +03:00
Igor Sysoev f0e9e3ace9 nginext has been renamed to unit. 2017-08-31 00:42:16 +03:00
Max Romanov 73dc76b0bf Separation of module prerequisites for 'all' target in Makefile.
To avoid using sed -i.
2017-08-29 11:33:34 -07:00
Igor Sysoev 93f7104a65 Added configure and command line option --help. 2017-08-26 13:37:44 +03:00
Igor Sysoev 949548da29 The new module configuration interface.
Configuration and building example:

  ./configure
  ./configure python
  ./configure php
  ./configure go
  make all

or

  ./configure
  make nginext
  ./configure python
  make python
  ./configure php
  make php
  ./configure go
  make go

Modules configuration options and building examples:

  ./configure python --module=python2 --config=python2.7-config
  make python2

  ./configure php --module=php7 --config=php7.0-config
                  --lib-path=/usr/local/php7.0
  make php7

  ./configure go --go=go1.6 --go-path=${HOME}/go1.6
  make go1.6
2017-08-17 21:47:19 +03:00
Igor Sysoev 5ef8e0ee89 Removing auto/modules directory before commiting the new module
configuration infrastructure.
2017-08-17 21:47:19 +03:00
Igor Sysoev e62840cd54 Introducing configure option --with-php-ldflags=. 2017-08-04 08:21:22 +03:00
Igor Sysoev 145eeb8476 Improved PHP configure test. 2017-07-26 12:17:41 +03:00
Max Romanov 5a43bd0bfd PHP app request processing. 2017-06-23 19:20:08 +03:00