History log of /unit/src/nxt_php_sapi.c (Results 1 – 25 of 75)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 2019:8fcb7e44c663 25-Nov-2021 Valentin Bartenev

PHP: fixed crash when calling module functions in OPcache preload.

In PHP, custom fastcgi_finish_request() and overloaded chdir() functions can be
invoked by an OPcache preloading script (it runs wh

PHP: fixed crash when calling module functions in OPcache preload.

In PHP, custom fastcgi_finish_request() and overloaded chdir() functions can be
invoked by an OPcache preloading script (it runs when php_module_startup() is
called in the app process setup handler). In this case, there was no runtime
context set so trying to access it caused a segmentation fault.

This closes #602 issue on GitHub.

show more ...


Revision tags: 1.26.0-1, 1.26.0
# 1980:43553aa72111 28-Oct-2021 Max Romanov

Moving request limit control to libunit.

Introducting application graceful stop. For now only used when application
process reach request limit value.

This closes #585 issue on GitHub.


Revision tags: 1.25.0-1, 1.25.0, 1.24.0-1, 1.24.0
# 1874:3d76ec426540 21-May-2021 Valentin Bartenev

PHP: adopted "file_handle" to Zend API changes in 8.1.0-dev.

This fixes building module with the development version of PHP after the change:
https://github.com/php/php-src/commit/c732ab400af92c54ee

PHP: adopted "file_handle" to Zend API changes in 8.1.0-dev.

This fixes building module with the development version of PHP after the change:
https://github.com/php/php-src/commit/c732ab400af92c54eee47c487a56009f1d79dd5d

show more ...


# 1861:570b306cc708 07-May-2021 Valentin Bartenev

PHP: forced initialization of $_SERVER in fastcgi_finish_request().

The "auto_globals_jit" PHP option postponed the initialization of the $_SERVER
global variable until the script using it had been

PHP: forced initialization of $_SERVER in fastcgi_finish_request().

The "auto_globals_jit" PHP option postponed the initialization of the $_SERVER
global variable until the script using it had been loaded (e. g. via the
"include" expression). As a result, nxt_php_register_variables() could be
called after fastcgi_finish_request() had finished the request and nulled
ctx->req, which thus caused a segmentation fault.

show more ...


Revision tags: 1.23.0-1, 1.23.0
# 1815:d0ee0d19a7a6 15-Mar-2021 Valentin Bartenev

Fixed building the PHP 5 module with ZTS, broken by dab8544b5440.

This closes #525 issue on GitHub.


Revision tags: 1.22.0-1, 1.22.0
# 1733:dab8544b5440 07-Dec-2020 Valentin Bartenev

PHP: populating PHP_AUTH_* server variables.

This closes #498 issue on GitHub.


Revision tags: 1.21.0-1, 1.21.0
# 1700:81c7ce33cd2a 10-Nov-2020 Valentin Bartenev

PHP: implementation of the fastcgi_finish_request() function.

This closes #219 issue on GitHub.


# 1699:03b60c8ddc99 10-Nov-2020 Valentin Bartenev

PHP: prevention of consuming unread request body on finalization.

The php_request_shutdown() function calls sapi_deactivate() that tries to read
request body into a dummy buffer. In our case it's j

PHP: prevention of consuming unread request body on finalization.

The php_request_shutdown() function calls sapi_deactivate() that tries to read
request body into a dummy buffer. In our case it's just waste of CPU cycles.

This change is also required for the following implementation of the
fastcgi_finish_request() function, where the request context can be
cleared by the time of finalization.

show more ...


Revision tags: 1.20.0-1, 1.20.0
# 1636:979d2b72930b 06-Oct-2020 Valentin Bartenev

PHP: compatibility with 8.0.0 RC1.

This closes #474 PR on GitHub.


# 1622:773f29e26072 09-Sep-2020 Tiago Natel de Moura

PHP: fixed "rootfs" isolation dependency on system mounts.


# 1583:0d343e154c46 25-Aug-2020 Tiago Natel de Moura

PHP: added bind mounts for extensions directory.


Revision tags: 1.19.0-1, 1.19.0
# 1562:7c405c015cba 12-Aug-2020 Remi Collet

PHP: compatibility with 8.0.0 Beta 1.

This closes #441 PR on GitHub.


# 1525:dc00c21f5bb4 24-Jul-2020 Valentin Bartenev

Configuration: added checking for presence of mandatory fields.


# 1519:8277976f9749 23-Jul-2020 Max Romanov

PHP: using nxt_unit_default_init() for module structure init.

Using this function in all language modules helps to avoid code duplication
and reduce the size of future patches.


# 1517:c55c3ad3f8d4 23-Jul-2020 Max Romanov

PHP: removing assertion to fix build on macOS.

The nxt_assert macro uses nxt_thread_context, which caused the following linker
error when using it in the library:

ld: illegal thread local variable

PHP: removing assertion to fix build on macOS.

The nxt_assert macro uses nxt_thread_context, which caused the following linker
error when using it in the library:

ld: illegal thread local variable reference to regular symbol
_nxt_thread_context for architecture x86_64

show more ...


# 1514:4c67dc5af5cc 21-Jul-2020 Valentin Bartenev

PHP: logging in request context when possible.


# 1513:8907fca3c528 21-Jul-2020 Valentin Bartenev

PHP: fixed incorrect time in interpreter error log messages.

Previously, the log message callback used a generic log function, that relied on the process time cache.
Since there were no time update

PHP: fixed incorrect time in interpreter error log messages.

Previously, the log message callback used a generic log function, that relied on the process time cache.
Since there were no time update calls in the application processes, all log lines were printed with the
same time, usually correlated with the process start.

Now, a non-cached logging function from libunit is used.

show more ...


Revision tags: 1.18.0-1, 1.18.0
# 1489:4a3ec07f4b19 28-May-2020 Tiago Natel de Moura

Added "rootfs" feature.


# 1488:6976d36be926 09-Mar-2020 Tiago Natel de Moura

Refactor of process management.

The process abstraction has changed to:

setup(task, process)
start(task, process_data)
prefork(task, process, mp)

The prefork() occurs in the main process rig

Refactor of process management.

The process abstraction has changed to:

setup(task, process)
start(task, process_data)
prefork(task, process, mp)

The prefork() occurs in the main process right before fork.

The file src/nxt_main_process.c is completely free of process
specific logic.

The creation of a process now supports a PROCESS_CREATED state. The
The setup() function of each process can set its state to either
created or ready. If created, a MSG_PROCESS_CREATED is sent to main
process, where external setup can be done (required for rootfs under
container).

The core processes (discovery, controller and router) doesn't need
external setup, then they all proceeds to their start() function
straight away.

In the case of applications, the load of the module happens at the
process setup() time and The module's init() function has changed
to be the start() of the process.

The module API has changed to:

setup(task, process, conf)
start(task, data)

As a direct benefit of the PROCESS_CREATED message, the clone(2) of
processes using pid namespaces now doesn't need to create a pipe
to make the child block until parent setup uid/gid mappings nor it
needs to receive the child pid.

show more ...


# 1482:90460ae5046a 20-May-2020 Remi Collet

PHP: building with PHP 8 (development version).


# 1473:e07d5b451423 14-May-2020 Valentin Bartenev

PHP: implemented "targets" option.

This allows to specify multiple subsequent targets inside PHP applications.
For example:

{
"listeners": {
"*:80": {
"pass": "route

PHP: implemented "targets" option.

This allows to specify multiple subsequent targets inside PHP applications.
For example:

{
"listeners": {
"*:80": {
"pass": "routes"
}
},

"routes": [
{
"match": {
"uri": "/info"
},

"action": {
"pass": "applications/my_app/phpinfo"
}
},
{
"match": {
"uri": "/hello"
},

"action": {
"pass": "applications/my_app/hello"
}
},
{
"action": {
"pass": "applications/my_app/rest"
}
}
],

"applications": {
"my_app": {
"type": "php",
"targets": {
"phpinfo": {
"script": "phpinfo.php",
"root": "/www/data/admin",
},

"hello": {
"script": "hello.php",
"root": "/www/data/test",
},

"rest": {
"root": "/www/data/example.com",
"index": "index.php"
},
}
}
}
}

show more ...


Revision tags: 1.17.0-1, 1.17.0, 1.16.0-1, 1.16.0
# 1385:bac7a5466145 04-Mar-2020 Tiago Natel de Moura

PHP: fixed log format in alert.

Found by Coverity: CID 354832 and CID 354833.


# 1376:2ecb15904ba5 03-Mar-2020 Tiago Natel de Moura

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

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.

show more ...


# 1369:85ab49b84bf9 25-Feb-2020 Tiago Natel de Moura

PHP: fixed php >= 7.4 with zts enabled.


Revision tags: 1.15.0-1, 1.15.0
# 1345:e40027481af0 28-Jan-2020 Valentin Bartenev

PHP: added check for the ".php" extension.

A check for the ".php" extension is added to prevent execution of files
with arbitrary extensions in cases where "index" and "script" options
aren't used.


123