nxt_php_sapi.c (1482:90460ae5046a) nxt_php_sapi.c (1488:6976d36be926)
1/*
2 * Copyright (C) Max Romanov
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "php.h"
8#include "SAPI.h"

--- 58 unchanged lines hidden (view full) ---

67typedef int (*nxt_php_disable_t)(char *p, uint TSRMLS_DC);
68#endif
69
70#if PHP_VERSION_ID < 70200
71typedef void (*zif_handler)(INTERNAL_FUNCTION_PARAMETERS);
72#endif
73
74
1/*
2 * Copyright (C) Max Romanov
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "php.h"
8#include "SAPI.h"

--- 58 unchanged lines hidden (view full) ---

67typedef int (*nxt_php_disable_t)(char *p, uint TSRMLS_DC);
68#endif
69
70#if PHP_VERSION_ID < 70200
71typedef void (*zif_handler)(INTERNAL_FUNCTION_PARAMETERS);
72#endif
73
74
75static nxt_int_t nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf);
75static nxt_int_t nxt_php_start(nxt_task_t *task, nxt_process_data_t *data);
76static nxt_int_t nxt_php_set_target(nxt_task_t *task, nxt_php_target_t *target,
77 nxt_conf_value_t *conf);
78static void nxt_php_set_options(nxt_task_t *task, nxt_conf_value_t *options,
79 int type);
80static nxt_int_t nxt_php_alter_option(nxt_str_t *name, nxt_str_t *value,
81 int type);
82static void nxt_php_disable(nxt_task_t *task, const char *type,
83 nxt_str_t *value, char **ptr, nxt_php_disable_t disable);

--- 153 unchanged lines hidden (view full) ---

237
238
239NXT_EXPORT nxt_app_module_t nxt_app_module = {
240 sizeof(compat),
241 compat,
242 nxt_string("php"),
243 PHP_VERSION,
244 NULL,
76static nxt_int_t nxt_php_set_target(nxt_task_t *task, nxt_php_target_t *target,
77 nxt_conf_value_t *conf);
78static void nxt_php_set_options(nxt_task_t *task, nxt_conf_value_t *options,
79 int type);
80static nxt_int_t nxt_php_alter_option(nxt_str_t *name, nxt_str_t *value,
81 int type);
82static void nxt_php_disable(nxt_task_t *task, const char *type,
83 nxt_str_t *value, char **ptr, nxt_php_disable_t disable);

--- 153 unchanged lines hidden (view full) ---

237
238
239NXT_EXPORT nxt_app_module_t nxt_app_module = {
240 sizeof(compat),
241 compat,
242 nxt_string("php"),
243 PHP_VERSION,
244 NULL,
245 nxt_php_init,
245 nxt_php_start,
246};
247
248
249static nxt_php_target_t *nxt_php_targets;
250static nxt_int_t nxt_php_last_target = -1;
251
252static nxt_task_t *nxt_php_task;
253#if defined(ZTS) && PHP_VERSION_ID < 70400
254static void ***tsrm_ls;
255#endif
256
257
258static nxt_int_t
246};
247
248
249static nxt_php_target_t *nxt_php_targets;
250static nxt_int_t nxt_php_last_target = -1;
251
252static nxt_task_t *nxt_php_task;
253#if defined(ZTS) && PHP_VERSION_ID < 70400
254static void ***tsrm_ls;
255#endif
256
257
258static nxt_int_t
259nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
259nxt_php_start(nxt_task_t *task, nxt_process_data_t *data)
260{
260{
261 u_char *p;
262 uint32_t next;
263 nxt_str_t ini_path, name;
264 nxt_int_t ret;
265 nxt_uint_t n;
266 nxt_port_t *my_port, *main_port;
267 nxt_runtime_t *rt;
268 nxt_unit_ctx_t *unit_ctx;
269 nxt_unit_init_t php_init;
270 nxt_conf_value_t *value;
271 nxt_php_app_conf_t *c;
261 u_char *p;
262 uint32_t next;
263 nxt_str_t ini_path, name;
264 nxt_int_t ret;
265 nxt_uint_t n;
266 nxt_port_t *my_port, *main_port;
267 nxt_runtime_t *rt;
268 nxt_unit_ctx_t *unit_ctx;
269 nxt_unit_init_t php_init;
270 nxt_conf_value_t *value;
271 nxt_php_app_conf_t *c;
272 nxt_common_app_conf_t *conf;
272
273 static nxt_str_t file_str = nxt_string("file");
274 static nxt_str_t user_str = nxt_string("user");
275 static nxt_str_t admin_str = nxt_string("admin");
276
277 nxt_php_task = task;
278
273
274 static nxt_str_t file_str = nxt_string("file");
275 static nxt_str_t user_str = nxt_string("user");
276 static nxt_str_t admin_str = nxt_string("admin");
277
278 nxt_php_task = task;
279
280 conf = data->app;
279 c = &conf->u.php;
280
281 n = (c->targets != NULL) ? nxt_conf_object_members_count(c->targets) : 1;
282
283 nxt_php_targets = nxt_zalloc(sizeof(nxt_php_target_t) * n);
284 if (nxt_slow_path(nxt_php_targets == NULL)) {
285 return NXT_ERROR;
286 }

--- 93 unchanged lines hidden (view full) ---

380 php_init.callbacks.request_handler = nxt_php_request_handler;
381
382 php_init.ready_port.id.pid = main_port->pid;
383 php_init.ready_port.id.id = main_port->id;
384 php_init.ready_port.out_fd = main_port->pair[1];
385
386 nxt_fd_blocking(task, main_port->pair[1]);
387
281 c = &conf->u.php;
282
283 n = (c->targets != NULL) ? nxt_conf_object_members_count(c->targets) : 1;
284
285 nxt_php_targets = nxt_zalloc(sizeof(nxt_php_target_t) * n);
286 if (nxt_slow_path(nxt_php_targets == NULL)) {
287 return NXT_ERROR;
288 }

--- 93 unchanged lines hidden (view full) ---

382 php_init.callbacks.request_handler = nxt_php_request_handler;
383
384 php_init.ready_port.id.pid = main_port->pid;
385 php_init.ready_port.id.id = main_port->id;
386 php_init.ready_port.out_fd = main_port->pair[1];
387
388 nxt_fd_blocking(task, main_port->pair[1]);
389
388 php_init.ready_stream = my_port->process->init->stream;
390 php_init.ready_stream = my_port->process->stream;
389
390 php_init.read_port.id.pid = my_port->pid;
391 php_init.read_port.id.id = my_port->id;
392 php_init.read_port.in_fd = my_port->pair[0];
393
394 nxt_fd_blocking(task, my_port->pair[0]);
395
396 php_init.log_fd = 2;

--- 881 unchanged lines hidden ---
391
392 php_init.read_port.id.pid = my_port->pid;
393 php_init.read_port.id.id = my_port->id;
394 php_init.read_port.in_fd = my_port->pair[0];
395
396 nxt_fd_blocking(task, my_port->pair[0]);
397
398 php_init.log_fd = 2;

--- 881 unchanged lines hidden ---