History log of /unit/src/nxt_php_sapi.c (Results 1 – 25 of 80)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 2231:5b3a69fd47a7 02-Nov-2022 Alejandro Colomar

Removed the unsafe nxt_memcmp() wrapper for memcmp(3).

The casts are unnecessary, since memcmp(3)'s arguments are 'void *'.
It might have been necessary in the times of K&R, where 'void *' didn't
ex

Removed the unsafe nxt_memcmp() wrapper for memcmp(3).

The casts are unnecessary, since memcmp(3)'s arguments are 'void *'.
It might have been necessary in the times of K&R, where 'void *' didn't
exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can
hide all classes of bugs by silencing most compiler warnings.

The changes from nxt_memcmp() to memcmp(3) were scripted:

$ find src/ -type f \
| grep '\.[ch]$' \
| xargs sed -i 's/nxt_memcmp/memcmp/'

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>

show more ...


# 2230:83b2d20d8f5c 16-Sep-2022 Andrew Clayton

PHP: allowed to specify URLs without a trailing '/'.

Both @lucatacconi & @mwoodpatrick reported what appears to be the same
issue on GitHub. Namely that when using the PHP language module and
trying

PHP: allowed to specify URLs without a trailing '/'.

Both @lucatacconi & @mwoodpatrick reported what appears to be the same
issue on GitHub. Namely that when using the PHP language module and
trying to access a URL that is a directory but without specifying the
trailing '/', they were getting a '503 Service Unavailable' error.

Note: This is when _not_ using the 'script' option.

E.g with the following config

{
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},

"applications": {
"php": {
"type": "php",
"root": "/var/tmp/unit-php"
}
}
}

and with a directory path of /var/tmp/unit-php/foo containing an
index.php, you would see the following

$ curl http://localhost/foo
<title>Error 503</title>
Error 503

However

$ curl http://localhost/foo/

would work and serve up the index.php

This commit fixes the above so you get the desired behaviour without
specifying the trailing '/' by doing the following

1] If the URL doesn't end in .php and doesn't have a trailing '/'
then check if the requested path is a directory.

2) If it is a directory then create a 301 re-direct pointing to it.
This matches the behaviour of the likes of nginx, Apache and
lighttpd.

This also matches the behaviour of the "share" action in Unit.

This doesn't effect the behaviour of the 'script' option which bypasses
the nxt_php_dynamic_request() function.

This also adds a couple of tests to test/test_php_application.py to
ensure this continues to work.

Closes: <https://github.com/nginx/unit/issues/717>
Closes: <https://github.com/nginx/unit/issues/753>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...


# 2219:b3c156896c7c 13-Oct-2022 Remi Collet

Added parentheses for consistency.

Reported-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Remi Collet <remi@remirepo.net>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: A

Added parentheses for consistency.

Reported-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Remi Collet <remi@remirepo.net>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>

show more ...


# 2218:ed81ed291d0b 02-Jun-2022 Remi Collet

PHP: Fixed php_module_startup() call for PHP 8.2.

PHP 8.2 changed the prototype of the function, removing the last
parameter.

Signed-off-by: Remi Collet <remi@remirepo.net>
Cc: Timo Stark <t.stark@

PHP: Fixed php_module_startup() call for PHP 8.2.

PHP 8.2 changed the prototype of the function, removing the last
parameter.

Signed-off-by: Remi Collet <remi@remirepo.net>
Cc: Timo Stark <t.stark@nginx.com>
Cc: George Peter Banyard <girgias@php.net>
Tested-by: Andy Postnikov <apostnikov@gmail.com>
Acked-by: Andy Postnikov <apostnikov@gmail.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>

show more ...


# 2208:26af8eadc943 29-Sep-2022 Andrew Clayton

Renamed a couple of members of nxt_unit_request_t.

This is a preparatory patch that renames the 'local' and 'local_length'
members of the nxt_unit_request_t structure to 'local_addr' and
'local_addr

Renamed a couple of members of nxt_unit_request_t.

This is a preparatory patch that renames the 'local' and 'local_length'
members of the nxt_unit_request_t structure to 'local_addr' and
'local_addr_length' in preparation for the adding of 'local_port' and
'local_port_length' members.

Suggested-by: Zhidao HONG <z.hong@f5.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...


Revision tags: 1.28.0-1, 1.28.0, 1.27.0-1, 1.27.0, 1.26.1-1, 1.26.1
# 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).


1234