mirror of
https://github.com/php/php-src.git
synced 2026-03-29 11:42:17 +02:00
switch the configuration syntax from xml to ini
It's been describe in the RFC: http://wiki.php.net/rfc/fpm/ini_syntax
This commit is contained in:
@@ -8,11 +8,6 @@ minimum_libevent_version="1.4.11"
|
||||
PHP_ARG_ENABLE(fpm,,
|
||||
[ --enable-fpm EXPERIMENTAL: Enable building of the fpm SAPI executable], no, no)
|
||||
|
||||
if test -z "$PHP_LIBXML_DIR"; then
|
||||
PHP_ARG_WITH(libxml-dir, libxml2 install dir,
|
||||
[ --with-libxml-dir=DIR FPM: libxml2 install prefix], no, no)
|
||||
fi
|
||||
|
||||
dnl libevent check function {{{
|
||||
dnl @synopsis AC_LIB_EVENT([MINIMUM-VERSION])
|
||||
dnl
|
||||
@@ -515,11 +510,6 @@ if test "$PHP_FPM" != "no"; then
|
||||
AC_MSG_ERROR([build test failed. Please check the config.log for details.])
|
||||
], $LIBEVENT_LIBS)
|
||||
|
||||
PHP_SETUP_LIBXML(FPM_SHARED_LIBADD, [
|
||||
], [
|
||||
AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
|
||||
])
|
||||
|
||||
AC_FPM_STDLIBS
|
||||
AC_FPM_PRCTL
|
||||
AC_FPM_CLOCK
|
||||
@@ -593,7 +583,6 @@ if test "$PHP_FPM" != "no"; then
|
||||
fpm/fpm_stdio.c \
|
||||
fpm/fpm_unix.c \
|
||||
fpm/fpm_worker_pool.c \
|
||||
fpm/xml_config.c \
|
||||
fpm/zlog.c \
|
||||
"
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ void fcgi_set_allowed_clients(char *ip)
|
||||
}
|
||||
allowed_clients[n] = inet_addr(cur);
|
||||
if (allowed_clients[n] == INADDR_NONE) {
|
||||
fprintf(stderr, "Wrong IP address '%s' in FCGI_WEB_SERVER_ADDRS\n", cur);
|
||||
fprintf(stderr, "Wrong IP address '%s' in FCGI_WEB_SERVER_ADDRS or listen.allowed_clients\n", cur);
|
||||
}
|
||||
n++;
|
||||
cur = end;
|
||||
@@ -383,6 +383,7 @@ void fcgi_set_allowed_clients(char *ip)
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
static int is_port_number(const char *bindpath)
|
||||
{
|
||||
while (*bindpath) {
|
||||
|
||||
@@ -143,7 +143,7 @@ static struct fpm_child_s *fpm_child_find(pid_t pid) /* {{{ */
|
||||
|
||||
static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
{
|
||||
fpm_globals.max_requests = wp->config->max_requests;
|
||||
fpm_globals.max_requests = wp->config->pm_max_requests;
|
||||
|
||||
if (0 > fpm_stdio_init_child(wp) ||
|
||||
0 > fpm_status_init_child(wp) ||
|
||||
@@ -355,14 +355,14 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to
|
||||
struct fpm_child_s *child;
|
||||
int max;
|
||||
|
||||
if (wp->config->pm->style == PM_STYLE_DYNAMIC) {
|
||||
if (wp->config->pm == PM_STYLE_DYNAMIC) {
|
||||
if (!in_event_loop) { /* starting */
|
||||
max = wp->config->pm->dynamic.start_servers;
|
||||
max = wp->config->pm_start_servers;
|
||||
} else {
|
||||
max = wp->running_children + nb_to_spawn;
|
||||
}
|
||||
} else { /* PM_STYLE_STATIC */
|
||||
max = wp->config->pm->max_children;
|
||||
max = wp->config->pm_max_children;
|
||||
}
|
||||
|
||||
while (!enough && fpm_pctl_can_spawn_children() && wp->running_children < max) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,9 @@
|
||||
#ifndef FPM_CONF_H
|
||||
#define FPM_CONF_H 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "php.h"
|
||||
|
||||
#define FPM_CONF_MAX_PONG_LENGTH 64
|
||||
|
||||
struct key_value_s;
|
||||
@@ -26,46 +29,42 @@ struct fpm_global_config_s {
|
||||
|
||||
extern struct fpm_global_config_s fpm_global_config;
|
||||
|
||||
struct fpm_pm_s {
|
||||
int style;
|
||||
int max_children;
|
||||
char *status;
|
||||
char *ping;
|
||||
char *pong;
|
||||
struct {
|
||||
int start_servers;
|
||||
int min_spare_servers;
|
||||
int max_spare_servers;
|
||||
} dynamic;
|
||||
};
|
||||
|
||||
struct fpm_listen_options_s {
|
||||
int backlog;
|
||||
char *owner;
|
||||
char *group;
|
||||
char *mode;
|
||||
};
|
||||
|
||||
struct fpm_worker_pool_config_s {
|
||||
char *name;
|
||||
char *listen_address;
|
||||
struct fpm_listen_options_s *listen_options;
|
||||
struct key_value_s *php_values;
|
||||
struct key_value_s *php_admin_values;
|
||||
char *user;
|
||||
char *group;
|
||||
char *chroot;
|
||||
char *chdir;
|
||||
char *allowed_clients;
|
||||
struct key_value_s *environment;
|
||||
struct fpm_pm_s *pm;
|
||||
int request_terminate_timeout;
|
||||
int request_slowlog_timeout;
|
||||
char *slowlog;
|
||||
int max_requests;
|
||||
int rlimit_files;
|
||||
int rlimit_core;
|
||||
unsigned catch_workers_output:1;
|
||||
int catch_workers_output;
|
||||
int pm;
|
||||
int pm_max_children;
|
||||
char *pm_status_path;
|
||||
int pm_max_requests;
|
||||
int pm_start_servers;
|
||||
int pm_min_spare_servers;
|
||||
int pm_max_spare_servers;
|
||||
char *ping_path;
|
||||
char *ping_response;
|
||||
char *listen_address;
|
||||
int listen_backlog;
|
||||
char *listen_owner;
|
||||
char *listen_group;
|
||||
char *listen_mode;
|
||||
char *listen_allowed_clients;
|
||||
struct key_value_s *env;
|
||||
struct key_value_s *php_admin_values;
|
||||
struct key_value_s *php_values;
|
||||
};
|
||||
|
||||
struct ini_value_parser_s {
|
||||
char *name;
|
||||
char *(*parser)(zval *, void **, intptr_t);
|
||||
intptr_t offset;
|
||||
};
|
||||
|
||||
enum { PM_STYLE_STATIC = 1, PM_STYLE_DYNAMIC = 2 };
|
||||
|
||||
@@ -117,7 +117,7 @@ int fpm_env_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
|
||||
clearenv();
|
||||
|
||||
for (kv = wp->config->environment; kv; kv = kv->next) {
|
||||
for (kv = wp->config->env; kv; kv = kv->next) {
|
||||
setenv(kv->key, kv->value, 1);
|
||||
}
|
||||
|
||||
@@ -137,9 +137,7 @@ static int fpm_env_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
{
|
||||
struct key_value_s *kv;
|
||||
|
||||
kv = wp->config->environment;
|
||||
|
||||
for (kv = wp->config->environment; kv; kv = kv->next) {
|
||||
for (kv = wp->config->env; kv; kv = kv->next) {
|
||||
if (*kv->value == '$') {
|
||||
char *value = getenv(kv->value + 1);
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ static int fpm_php_apply_defines(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
static int fpm_php_set_allowed_clients(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
{
|
||||
if (wp->listen_address_domain == FPM_AF_INET) {
|
||||
fcgi_set_allowed_clients(wp->config->allowed_clients);
|
||||
fcgi_set_allowed_clients(wp->config->listen_allowed_clients);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ static int fpm_php_set_fcgi_mgmt_vars(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
char max_workers[10 + 1]; /* 4294967295 */
|
||||
int len;
|
||||
|
||||
len = sprintf(max_workers, "%u", (unsigned int) wp->config->pm->max_children);
|
||||
len = sprintf(max_workers, "%u", (unsigned int) wp->config->pm_max_children);
|
||||
|
||||
fcgi_set_mgmt_var("FCGI_MAX_CONNS", sizeof("FCGI_MAX_CONNS")-1, max_workers, len);
|
||||
fcgi_set_mgmt_var("FCGI_MAX_REQS", sizeof("FCGI_MAX_REQS")-1, max_workers, len);
|
||||
|
||||
@@ -352,21 +352,21 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct
|
||||
fpm_status_update_activity(wp->shm_status, idle, active, idle + active, 0);
|
||||
|
||||
/* the rest is only used by PM_STYLE_DYNAMIC */
|
||||
if (wp->config->pm->style != PM_STYLE_DYNAMIC) continue;
|
||||
if (wp->config->pm != PM_STYLE_DYNAMIC) continue;
|
||||
|
||||
zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] currently %d active children, %d spare children, %d running children. Spawning rate %d", wp->config->name, active, idle, wp->running_children, wp->idle_spawn_rate);
|
||||
|
||||
if (idle > wp->config->pm->dynamic.max_spare_servers && last_idle_child) {
|
||||
if (idle > wp->config->pm_max_spare_servers && last_idle_child) {
|
||||
last_idle_child->idle_kill = 1;
|
||||
fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_TERM);
|
||||
wp->idle_spawn_rate = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (idle < wp->config->pm->dynamic.min_spare_servers) {
|
||||
if (wp->running_children >= wp->config->pm->max_children) {
|
||||
if (idle < wp->config->pm_min_spare_servers) {
|
||||
if (wp->running_children >= wp->config->pm_max_children) {
|
||||
if (!wp->warn_max_children) {
|
||||
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm->max_children);
|
||||
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
|
||||
wp->warn_max_children = 1;
|
||||
}
|
||||
wp->idle_spawn_rate = 1;
|
||||
@@ -378,13 +378,13 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct
|
||||
}
|
||||
|
||||
/* compute the number of idle process to spawn */
|
||||
i = MIN(wp->idle_spawn_rate, wp->config->pm->dynamic.min_spare_servers - idle);
|
||||
i = MIN(wp->idle_spawn_rate, wp->config->pm_min_spare_servers - idle);
|
||||
|
||||
/* get sure it won't exceed max_children */
|
||||
i = MIN(i, wp->config->pm->max_children - wp->running_children);
|
||||
i = MIN(i, wp->config->pm_max_children - wp->running_children);
|
||||
if (i <= 0) {
|
||||
if (!wp->warn_max_children) {
|
||||
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm->max_children);
|
||||
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
|
||||
wp->warn_max_children = 1;
|
||||
}
|
||||
wp->idle_spawn_rate = 1;
|
||||
|
||||
@@ -164,16 +164,10 @@ static int fpm_sockets_hash_op(int sock, struct sockaddr *sa, char *key, int typ
|
||||
|
||||
static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct sockaddr *sa, int socklen) /* {{{ */
|
||||
{
|
||||
int backlog = -1;
|
||||
int flags = 1;
|
||||
int sock;
|
||||
mode_t saved_umask;
|
||||
|
||||
/* we have custom backlog value */
|
||||
if (wp->config->listen_options) {
|
||||
backlog = wp->config->listen_options->backlog;
|
||||
}
|
||||
|
||||
sock = socket(sa->sa_family, SOCK_STREAM, 0);
|
||||
|
||||
if (0 > sock) {
|
||||
@@ -205,7 +199,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
|
||||
}
|
||||
umask(saved_umask);
|
||||
|
||||
if (0 > listen(sock, backlog)) {
|
||||
if (0 > listen(sock, wp->config->listen_backlog)) {
|
||||
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "listen() for address '%s' failed", wp->config->listen_address);
|
||||
return -1;
|
||||
}
|
||||
@@ -333,23 +327,21 @@ int fpm_sockets_init_main() /* {{{ */
|
||||
|
||||
/* create all required sockets */
|
||||
for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
|
||||
if (!wp->is_template) {
|
||||
switch (wp->listen_address_domain) {
|
||||
case FPM_AF_INET :
|
||||
wp->listening_socket = fpm_socket_af_inet_listening_socket(wp);
|
||||
break;
|
||||
switch (wp->listen_address_domain) {
|
||||
case FPM_AF_INET :
|
||||
wp->listening_socket = fpm_socket_af_inet_listening_socket(wp);
|
||||
break;
|
||||
|
||||
case FPM_AF_UNIX :
|
||||
if (0 > fpm_unix_resolve_socket_premissions(wp)) {
|
||||
return -1;
|
||||
}
|
||||
wp->listening_socket = fpm_socket_af_unix_listening_socket(wp);
|
||||
break;
|
||||
}
|
||||
case FPM_AF_UNIX :
|
||||
if (0 > fpm_unix_resolve_socket_premissions(wp)) {
|
||||
return -1;
|
||||
}
|
||||
wp->listening_socket = fpm_socket_af_unix_listening_socket(wp);
|
||||
break;
|
||||
}
|
||||
|
||||
if (wp->listening_socket == -1) {
|
||||
return -1;
|
||||
}
|
||||
if (wp->listening_socket == -1) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
zlog(ZLOG_STUFF, ZLOG_ERROR, "unable to init fpm_status because conf structure is NULL");
|
||||
return -1;
|
||||
}
|
||||
if (wp->config->pm->status || wp->config->pm->ping) {
|
||||
if (wp->config->pm->status) {
|
||||
if (wp->config->pm_status_path || wp->config->ping_path) {
|
||||
if (wp->config->pm_status_path) {
|
||||
if (!wp->shm_status) {
|
||||
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to init fpm_status because the dedicated SHM has not been set", wp->config->name);
|
||||
return -1;
|
||||
@@ -32,16 +32,16 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
fpm_status_shm = wp->shm_status;
|
||||
}
|
||||
fpm_status_pool = strdup(wp->config->name);
|
||||
if (wp->config->pm->status) {
|
||||
fpm_status_uri = strdup(wp->config->pm->status);
|
||||
if (wp->config->pm_status_path) {
|
||||
fpm_status_uri = strdup(wp->config->pm_status_path);
|
||||
}
|
||||
if (wp->config->pm->ping) {
|
||||
if (!wp->config->pm->pong) {
|
||||
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] ping is set (%s) but pong is not set.", wp->config->name, wp->config->pm->ping);
|
||||
if (wp->config->ping_path) {
|
||||
if (!wp->config->ping_response) {
|
||||
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] ping is set (%s) but pong is not set.", wp->config->name, wp->config->ping_path);
|
||||
return -1;
|
||||
}
|
||||
fpm_status_ping = strdup(wp->config->pm->ping);
|
||||
fpm_status_pong = strdup(wp->config->pm->pong);
|
||||
fpm_status_ping = strdup(wp->config->ping_path);
|
||||
fpm_status_pong = strdup(wp->config->ping_response);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -29,23 +29,23 @@ size_t fpm_pagesize;
|
||||
|
||||
int fpm_unix_resolve_socket_premissions(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
{
|
||||
struct fpm_listen_options_s *lo = wp->config->listen_options;
|
||||
struct fpm_worker_pool_config_s *c = wp->config;
|
||||
|
||||
/* uninitialized */
|
||||
wp->socket_uid = -1;
|
||||
wp->socket_gid = -1;
|
||||
wp->socket_mode = 0666;
|
||||
|
||||
if (!lo) {
|
||||
if (!c) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lo->owner && *lo->owner) {
|
||||
if (c->listen_owner && *c->listen_owner) {
|
||||
struct passwd *pwd;
|
||||
|
||||
pwd = getpwnam(lo->owner);
|
||||
pwd = getpwnam(c->listen_owner);
|
||||
if (!pwd) {
|
||||
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, lo->owner);
|
||||
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, c->listen_owner);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ int fpm_unix_resolve_socket_premissions(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
wp->socket_gid = pwd->pw_gid;
|
||||
}
|
||||
|
||||
if (lo->group && *lo->group) {
|
||||
if (c->listen_group && *c->listen_group) {
|
||||
struct group *grp;
|
||||
|
||||
grp = getgrnam(lo->group);
|
||||
grp = getgrnam(c->listen_group);
|
||||
if (!grp) {
|
||||
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, lo->group);
|
||||
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, c->listen_group);
|
||||
return -1;
|
||||
}
|
||||
wp->socket_gid = grp->gr_gid;
|
||||
}
|
||||
|
||||
if (lo->mode && *lo->mode) {
|
||||
wp->socket_mode = strtoul(lo->mode, 0, 8);
|
||||
if (c->listen_mode && *c->listen_mode) {
|
||||
wp->socket_mode = strtoul(c->listen_mode, 0, 8);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -152,6 +152,7 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
|
||||
getrlimit(RLIMIT_NOFILE, &r);
|
||||
r.rlim_cur = (rlim_t) wp->config->rlimit_files;
|
||||
// r.rlim_max = (rlim_t) wp->config->rlimit_files;
|
||||
if (0 > setrlimit(RLIMIT_NOFILE, &r)) {
|
||||
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_NOFILE) failed", wp->config->name);
|
||||
}
|
||||
|
||||
@@ -51,9 +51,6 @@ struct fpm_worker_pool_s *fpm_worker_pool_alloc() /* {{{ */
|
||||
}
|
||||
|
||||
memset(ret, 0, sizeof(struct fpm_worker_pool_s));
|
||||
if (!fpm_worker_all_pools) {
|
||||
fpm_worker_all_pools = ret;
|
||||
}
|
||||
|
||||
fpm_array_init(&ret->slots_used, sizeof(struct fpm_shm_slot_ptr_s), 50);
|
||||
fpm_array_init(&ret->slots_free, sizeof(struct fpm_shm_slot_ptr_s), 50);
|
||||
|
||||
@@ -26,7 +26,6 @@ struct fpm_worker_pool_s {
|
||||
enum fpm_address_domain listen_address_domain;
|
||||
int listening_socket;
|
||||
int set_uid, set_gid; /* config uid and gid */
|
||||
unsigned is_template:1; /* just config template, no processes will be created */
|
||||
int socket_uid, socket_gid, socket_mode;
|
||||
|
||||
struct fpm_shm_s *shm_list;
|
||||
|
||||
@@ -1,275 +0,0 @@
|
||||
|
||||
/* $Id: xml_config.c,v 1.9 2008/08/26 15:09:15 anight Exp $ */
|
||||
/* (c) 2004-2007 Andrei Nigmatulin */
|
||||
|
||||
#include "fpm_config.h"
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#include "xml_config.h"
|
||||
|
||||
static struct xml_conf_section **xml_conf_sections = 0;
|
||||
static int xml_conf_sections_allocated = 0;
|
||||
static int xml_conf_sections_used = 0;
|
||||
|
||||
char *xml_conf_set_slot_boolean(void **conf, char *name, void *vv, intptr_t offset) /* {{{ */
|
||||
{
|
||||
char *value = vv;
|
||||
long value_y = !strcasecmp(value, "yes") || !strcmp(value, "1") || !strcasecmp(value, "on") || !strcasecmp(value, "true");
|
||||
long value_n = !strcasecmp(value, "no") || !strcmp(value, "0") || !strcasecmp(value, "off") || !strcasecmp(value, "false");
|
||||
|
||||
if (!value_y && !value_n) {
|
||||
return "xml_conf_set_slot(): invalid boolean value";
|
||||
}
|
||||
|
||||
#ifdef XML_CONF_DEBUG
|
||||
fprintf(stderr, "setting boolean '%s' => %s\n", name, value_y ? "TRUE" : "FALSE");
|
||||
#endif
|
||||
|
||||
* (int *) ((char *) *conf + offset) = value_y ? 1 : 0;
|
||||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
char *xml_conf_set_slot_string(void **conf, char *name, void *vv, intptr_t offset) /* {{{ */
|
||||
{
|
||||
char *value = vv;
|
||||
char *v = strdup(value);
|
||||
|
||||
if (!v) {
|
||||
return "xml_conf_set_slot_string(): strdup() failed";
|
||||
}
|
||||
|
||||
#ifdef XML_CONF_DEBUG
|
||||
fprintf(stderr, "setting string '%s' => '%s'\n", name, v);
|
||||
#endif
|
||||
|
||||
* (char **) ((char *) *conf + offset) = v;
|
||||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
char *xml_conf_set_slot_integer(void **conf, char *name, void *vv, intptr_t offset) /* {{{ */
|
||||
{
|
||||
char *value = vv;
|
||||
int v = atoi(value);
|
||||
|
||||
* (int *) ((char *) *conf + offset) = v;
|
||||
|
||||
#ifdef XML_CONF_DEBUG
|
||||
fprintf(stderr, "setting integer '%s' => %d\n", name, v);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
char *xml_conf_set_slot_time(void **conf, char *name, void *vv, intptr_t offset) /* {{{ */
|
||||
{
|
||||
char *value = vv;
|
||||
int len = strlen(value);
|
||||
char suffix;
|
||||
int seconds;
|
||||
|
||||
if (!len) {
|
||||
return "xml_conf_set_slot_timeval(): invalid timeval value";
|
||||
}
|
||||
|
||||
suffix = value[len-1];
|
||||
value[len-1] = '\0';
|
||||
switch (suffix) {
|
||||
case 's' :
|
||||
seconds = atoi(value);
|
||||
break;
|
||||
case 'm' :
|
||||
seconds = 60 * atoi(value);
|
||||
break;
|
||||
case 'h' :
|
||||
seconds = 60 * 60 * atoi(value);
|
||||
break;
|
||||
case 'd' :
|
||||
seconds = 24 * 60 * 60 * atoi(value);
|
||||
break;
|
||||
default :
|
||||
return "xml_conf_set_slot_timeval(): unknown suffix used in timeval value";
|
||||
}
|
||||
|
||||
* (int *) ((char *) *conf + offset) = seconds;
|
||||
|
||||
#ifdef XML_CONF_DEBUG
|
||||
fprintf(stderr, "setting time '%s' => %d:%02d:%02d:%02d\n", name, expand_dhms(seconds));
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
char *xml_conf_parse_section(void **conf, struct xml_conf_section *section, void *xml_node) /* {{{ */
|
||||
{
|
||||
xmlNode *element = xml_node;
|
||||
char *ret = 0;
|
||||
|
||||
#ifdef XML_CONF_DEBUG
|
||||
fprintf(stderr, "processing a section %s\n", section->path);
|
||||
#endif
|
||||
|
||||
for ( ; element; element = element->next) {
|
||||
if (element->type == XML_ELEMENT_NODE && !strcmp((const char *) element->name, "value") && element->children) {
|
||||
xmlChar *name = xmlGetProp(element, (unsigned char *) "name");
|
||||
|
||||
if (name) {
|
||||
int i;
|
||||
|
||||
#ifdef XML_CONF_DEBUG
|
||||
fprintf(stderr, "found a value: %s\n", name);
|
||||
#endif
|
||||
for (i = 0; section->parsers[i].parser; i++) {
|
||||
if (!section->parsers[i].name || !strcmp(section->parsers[i].name, (char *) name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (section->parsers[i].parser) {
|
||||
if (section->parsers[i].type == XML_CONF_SCALAR) {
|
||||
if (element->children->type == XML_TEXT_NODE) {
|
||||
ret = section->parsers[i].parser(conf, (char *) name, element->children->content, section->parsers[i].offset);
|
||||
} else {
|
||||
ret = "XML_TEXT_NODE is expected, something different is given";
|
||||
}
|
||||
} else {
|
||||
ret = section->parsers[i].parser(conf, (char *) name, element->children, section->parsers[i].offset);
|
||||
}
|
||||
|
||||
xmlFree(name);
|
||||
if (ret) {
|
||||
return ret;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Warning, unknown setting '%s' in section '%s'\n", (char *) name, section->path);
|
||||
xmlFree(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static char *xml_conf_parse_file(xmlNode *element) /* {{{ */
|
||||
{
|
||||
char *ret = 0;
|
||||
|
||||
for ( ; element; element = element->next) {
|
||||
|
||||
if (element->parent && element->type == XML_ELEMENT_NODE && !strcmp((const char *) element->name, "section")) {
|
||||
xmlChar *name = xmlGetProp(element, (unsigned char *) "name");
|
||||
|
||||
if (name) {
|
||||
char *parent_name = (char *) xmlGetNodePath(element->parent);
|
||||
char *full_name;
|
||||
int i;
|
||||
struct xml_conf_section *section = NULL;
|
||||
|
||||
#ifdef XML_CONF_DEBUG
|
||||
fprintf(stderr, "got a section: %s/%s\n", parent_name, name);
|
||||
#endif
|
||||
full_name = alloca(strlen(parent_name) + strlen((char *) name) + 1 + 1);
|
||||
sprintf(full_name, "%s/%s", parent_name, (char *) name);
|
||||
xmlFree(parent_name);
|
||||
xmlFree(name);
|
||||
|
||||
for (i = 0; i < xml_conf_sections_used; i++) {
|
||||
if (!strcmp(xml_conf_sections[i]->path, full_name)) {
|
||||
section = xml_conf_sections[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (section) { /* found a registered section */
|
||||
void *conf = section->conf();
|
||||
ret = xml_conf_parse_section(&conf, section, element->children);
|
||||
if (ret) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (element->children) {
|
||||
ret = xml_conf_parse_file(element->children);
|
||||
if (ret) break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
char *xml_conf_load_file(char *file) /* {{{ */
|
||||
{
|
||||
char *ret = 0;
|
||||
xmlDoc *doc;
|
||||
|
||||
LIBXML_TEST_VERSION
|
||||
|
||||
doc = xmlParseFile(file);
|
||||
if (doc) {
|
||||
ret = xml_conf_parse_file(doc->children);
|
||||
xmlFreeDoc(doc);
|
||||
} else {
|
||||
ret = "failed to parse conf file";
|
||||
}
|
||||
xmlCleanupParser();
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int xml_conf_init() /* {{{ */
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void xml_conf_clean() /* {{{ */
|
||||
{
|
||||
if (xml_conf_sections) {
|
||||
free(xml_conf_sections);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int xml_conf_section_register(struct xml_conf_section *section) /* {{{ */
|
||||
{
|
||||
if (xml_conf_sections_allocated == xml_conf_sections_used) {
|
||||
int new_size = xml_conf_sections_used + 10;
|
||||
void *new_ptr = realloc(xml_conf_sections, sizeof(struct xml_conf_section *) * new_size);
|
||||
|
||||
if (new_ptr) {
|
||||
xml_conf_sections = new_ptr;
|
||||
xml_conf_sections_allocated = new_size;
|
||||
} else {
|
||||
fprintf(stderr, "xml_conf_section_register(): out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
xml_conf_sections[xml_conf_sections_used++] = section;
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int xml_conf_sections_register(struct xml_conf_section *sections[]) /* {{{ */
|
||||
{
|
||||
for ( ; sections && *sections; sections++) {
|
||||
if (0 > xml_conf_section_register(*sections)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
|
||||
/* $Id: xml_config.h,v 1.3 2008/09/18 23:02:58 anight Exp $ */
|
||||
/* (c) 2004-2007 Andrei Nigmatulin */
|
||||
|
||||
#ifndef XML_CONFIG_H
|
||||
#define XML_CONFIG_H 1
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
struct xml_value_parser;
|
||||
|
||||
struct xml_value_parser {
|
||||
int type;
|
||||
char *name;
|
||||
char *(*parser)(void **, char *, void *, intptr_t offset);
|
||||
intptr_t offset;
|
||||
};
|
||||
|
||||
struct xml_conf_section {
|
||||
void *(*conf)();
|
||||
char *path;
|
||||
struct xml_value_parser *parsers;
|
||||
};
|
||||
|
||||
char *xml_conf_set_slot_boolean(void **conf, char *name, void *value, intptr_t offset);
|
||||
char *xml_conf_set_slot_string(void **conf, char *name, void *value, intptr_t offset);
|
||||
char *xml_conf_set_slot_integer(void **conf, char *name, void *value, intptr_t offset);
|
||||
char *xml_conf_set_slot_time(void **conf, char *name, void *value, intptr_t offset);
|
||||
|
||||
int xml_conf_init();
|
||||
void xml_conf_clean();
|
||||
char *xml_conf_load_file(char *file);
|
||||
char *xml_conf_parse_section(void **conf, struct xml_conf_section *section, void *ve);
|
||||
int xml_conf_section_register(struct xml_conf_section *section);
|
||||
int xml_conf_sections_register(struct xml_conf_section *sections[]);
|
||||
|
||||
#define expand_hms(value) (value) / 3600, ((value) % 3600) / 60, (value) % 60
|
||||
|
||||
#define expand_dhms(value) (value) / 86400, ((value) % 86400) / 3600, ((value) % 3600) / 60, (value) % 60
|
||||
|
||||
enum { XML_CONF_SCALAR = 1, XML_CONF_SUBSECTION = 2 };
|
||||
|
||||
#endif
|
||||
@@ -1,216 +1,283 @@
|
||||
<?xml version="1.0" ?>
|
||||
<configuration>
|
||||
;
|
||||
; All relative paths in this config are relative to php's install prefix
|
||||
;
|
||||
;
|
||||
; Include one or more files.
|
||||
; If glob(3) exists, it's used to include a bunch of files from a glob(3) pattern
|
||||
; This directive can be used everywhere in the file.
|
||||
;
|
||||
;include=@EXPANDED_SYSCONFDIR@/fpm.d/*.conf
|
||||
;
|
||||
;
|
||||
|
||||
All relative paths in this config are relative to php's install prefix
|
||||
[global]
|
||||
; Pid file
|
||||
; default: none
|
||||
;
|
||||
;pid = @EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
|
||||
|
||||
<section name="global_options">
|
||||
; Error log file
|
||||
; default: @EXPANDED_LOCALSTATEDIR@/log/php-fpm.log
|
||||
;
|
||||
;error_log = @EXPANDED_LOCALSTATEDIR@/log/php-fpm.log
|
||||
|
||||
Pid file
|
||||
<value name="pid_file">@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid</value>
|
||||
; Log level
|
||||
; alert, error, warning, notice, debug
|
||||
; default: notice
|
||||
;
|
||||
;log_level = notice
|
||||
|
||||
Error log file
|
||||
<value name="error_log">@EXPANDED_LOCALSTATEDIR@/log/php-fpm.log</value>
|
||||
; When this amount of php processes exited with SIGSEGV or SIGBUS ...
|
||||
; 0 means 'Off'
|
||||
; default: 0
|
||||
;
|
||||
;emergency_restart_threshold = 0
|
||||
|
||||
Log level
|
||||
<value name="log_level">notice</value>
|
||||
; ... in a less than this interval of time, a graceful restart will be initiated.
|
||||
; Useful to work around accidental curruptions in accelerator's shared memory.
|
||||
; available units are s(econd), m(inute), h(hour), or d(day)
|
||||
; default : 0s
|
||||
;
|
||||
;emergency_restart_interval = 0s
|
||||
|
||||
When this amount of php processes exited with SIGSEGV or SIGBUS ...
|
||||
<value name="emergency_restart_threshold">10</value>
|
||||
; Time limit on waiting child's reaction on signals from master
|
||||
; available units are s(econd), m(inute), h(hour), or d(day)
|
||||
; default : 0s
|
||||
;
|
||||
;process_control_timeout = 0s
|
||||
|
||||
... in a less than this interval of time, a graceful restart will be initiated.
|
||||
Useful to work around accidental curruptions in accelerator's shared memory.
|
||||
<value name="emergency_restart_interval">1m</value>
|
||||
; send fpm to backgound (default)
|
||||
; set to 'no' to keep FPM in foreground for debugging
|
||||
; default : yes
|
||||
;
|
||||
;daemonize = yes
|
||||
|
||||
Time limit on waiting child's reaction on signals from master
|
||||
<value name="process_control_timeout">5s</value>
|
||||
; Start a new pool named 'www'
|
||||
; The name is used in logs and stats
|
||||
; There is no limitation of the number of pool FPM can handle. Your system will tell you anyway :)
|
||||
[www]
|
||||
|
||||
Set to 'no' to debug fpm
|
||||
<value name="daemonize">yes</value>
|
||||
; Address to accept fastcgi requests on.
|
||||
; Valid syntaxes are:
|
||||
; - 'ip.ad.re.ss:port' to listen on a TCP scoket to the specific address on the specific port
|
||||
; - 'port' to listen on a TCP socket to all addreses on the specific port
|
||||
; - '/path/to/unix/socket' to listen on a unix socket
|
||||
; it's mandatory
|
||||
;
|
||||
listen = 127.0.0.1:9000
|
||||
|
||||
</section>
|
||||
; Set listen(2) backlog
|
||||
; -1 means unlimited
|
||||
; default : -1
|
||||
;
|
||||
;listen.backlog = -1
|
||||
|
||||
<workers>
|
||||
; Set permissions for unix socket, if one used.
|
||||
; In Linux read/write permissions must be set in order to allow connections from web server.
|
||||
; Many BSD-derrived systems allow connections regardless of permissions.
|
||||
; default: user and group are set as the running user. Mode is set to 0666
|
||||
;
|
||||
;listen.owner = @php_fpm_user@
|
||||
;listen.group = @php_fpm_group@
|
||||
;listen.mode = 0666
|
||||
|
||||
<section name="pool">
|
||||
; Unix user/group of processes
|
||||
; The user is mandatory. If the group is not set, the default user's group
|
||||
; will be used
|
||||
user = @php_fpm_user@
|
||||
group = @php_fpm_group@
|
||||
|
||||
Name of pool. Used in logs and stats.
|
||||
<value name="name">default</value>
|
||||
; Choose the process manager which control how processes are managed
|
||||
; Two choices:
|
||||
; - static : a fixed number (pm.max_children) of child processes
|
||||
; - dynamic : The number of child processes are set up dynamically depending on the following directives
|
||||
; - pm.max_children : the maximum number of children that can be alive at the same time
|
||||
; - pm.start_servers : the number of children created on startup
|
||||
; - pm.min_spare_servers : the minimum number of children in 'idle' state (waiting to precess).
|
||||
; If the number of 'idle' processes is less than this number,
|
||||
; some children will be created.
|
||||
; - pm.max_spare_servers : the maximum number of children in 'idle' state (waiting to precess).
|
||||
; If the number of 'idle' processes is greater than this number,
|
||||
; some children will be killed;
|
||||
; It's mandatory
|
||||
pm = dynamic
|
||||
|
||||
Address to accept fastcgi requests on.
|
||||
Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
|
||||
<value name="listen_address">127.0.0.1:9000</value>
|
||||
; Sets the limit on the number of simultaneous requests (children processes will be forked) that will be served.
|
||||
; Equivalent to Apache MaxClients directive (with mpm_prefork).
|
||||
; Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
|
||||
; Used with any pm.style.
|
||||
; It's mandatory
|
||||
;
|
||||
pm.max_children = 50
|
||||
|
||||
<value name="listen_options">
|
||||
; Sets the number of server processes created on startup.
|
||||
; Used only with 'dynamic' pm.style
|
||||
; default : min_spare + (max_spare - min_spare) / 2
|
||||
;
|
||||
;pm.start_servers = 20
|
||||
|
||||
Set listen(2) backlog
|
||||
<value name="backlog">-1</value>
|
||||
; Sets the desired minimum number of idle server processes.
|
||||
; Used only with 'dynamic' pm.style
|
||||
; It's mandatory when pm is set to dynamic
|
||||
;
|
||||
;pm.min_spare_servers = 5
|
||||
|
||||
Set permissions for unix socket, if one used.
|
||||
In Linux read/write permissions must be set in order to allow connections from web server.
|
||||
Many BSD-derrived systems allow connections regardless of permissions.
|
||||
<value name="owner">@php_fpm_user@</value>
|
||||
<value name="group">@php_fpm_group@</value>
|
||||
<value name="mode">0666</value>
|
||||
</value>
|
||||
; Sets the desired maximum number of idle server processes.
|
||||
; Used only with 'dynamic' pm.style
|
||||
; It's mandatory when pm is set to dynamic
|
||||
;
|
||||
;pm.max_spare_servers = 35
|
||||
|
||||
; How much requests each process should execute before respawn.
|
||||
; Useful to work around memory leaks in 3rd party libraries.
|
||||
; For endless request processing please specify 0
|
||||
; Equivalent to PHP_FCGI_MAX_REQUESTS
|
||||
; default : 0
|
||||
;
|
||||
;max_requests = 500
|
||||
|
||||
Additional php.ini defines, specific to this pool of workers.
|
||||
These settings overwrite the values previously defined in the php.ini.
|
||||
Like apache, you can use php_value, php_flag, php_admin_value or php_admin_flag.
|
||||
Defining 'extension' will search for the corresponding shared extension in extension_dir.
|
||||
Defining 'disable_functions' or 'disable_classes' won't overwrite previously defined
|
||||
php.ini value, but the new value will be append.
|
||||
<value name="php_value">
|
||||
<!-- <value name="error_log">/var/log/php-error.log</value> -->
|
||||
</value>
|
||||
<value name="php_flag">
|
||||
<!-- <value name="log_errors">true</value> -->
|
||||
</value>
|
||||
<value name="php_admin_value">
|
||||
<!-- <value name="sendmail_path">/usr/sbin/sendmail -t -i</value> -->
|
||||
</value>
|
||||
<value name="php_admin_flag">
|
||||
<!-- <value name="display_errors">0</value> -->
|
||||
</value>
|
||||
; Sets the status URI to call to obtain php-fpm status page.
|
||||
; If not set, no URI will be recognized as a status page.
|
||||
; By default, it returns text/plain looking like:
|
||||
; accepted conn: 12073
|
||||
; pool: default
|
||||
; process manager: static
|
||||
; idle processes: 35
|
||||
; active processes: 65
|
||||
; total processes: 100
|
||||
; "accepted conn" : the number of request accepted by the pool
|
||||
; "pool" : the name of the pool
|
||||
; "process manager": static or dynamic
|
||||
; "idle processes": the number of idle processes
|
||||
; "active processes": the number of active processes
|
||||
; "total processes": idle + active
|
||||
; The last three number are uptaded every second.
|
||||
; The "accepted conn" is updated in real time
|
||||
; *** Output ***
|
||||
; By default it returns text/plain
|
||||
; But passing as a query string html or json, it will returns
|
||||
; the corresponding output syntax:
|
||||
; http://www.foo.bar/status
|
||||
; http://www.foo.bar/status?json
|
||||
; http://www.foo.bar/status?html
|
||||
; *** WARNING ***
|
||||
; It has to start with a /. It could be named has you want.
|
||||
; It's maybe not a good idea to use .php extension to be certain
|
||||
; not to conflict with a real PHP file
|
||||
;
|
||||
; default: not set
|
||||
;
|
||||
;pm.status_path = /status
|
||||
|
||||
; Set the ping URI to call the monitoring page of php-fpm
|
||||
; If not set, no URI will be recognized as a ping page.
|
||||
; This could be used to test from outside that php-fpm
|
||||
; is alive and responding:
|
||||
; - have a graph of php-fpm availability (rrd or such)
|
||||
; - remove a server from a pool if it's not responding (load balancing systems)
|
||||
; - trigger alerts for the operating team (24/7)
|
||||
; *** WARNING ***
|
||||
; It has to start with a /. It could be named has you want.
|
||||
; It's maybe not a good idea to use .php extension to be certain
|
||||
; not to conflict with a real PHP file
|
||||
;
|
||||
; default: not set
|
||||
;
|
||||
;ping.path = /ping
|
||||
|
||||
Unix user of processes
|
||||
<value name="user">@php_fpm_user@</value>
|
||||
; Set the response to custom the response of a ping request
|
||||
; If 'pong' is not set, the default is "pong".
|
||||
; The response is text/plain with a 200 response code
|
||||
;
|
||||
; default: pong
|
||||
;
|
||||
;pong.response = pong
|
||||
|
||||
; The timeout (in seconds) for serving a single request after which the worker process will be terminated
|
||||
; Should be used when 'max_execution_time' ini option does not stop script execution for some reason
|
||||
; '0' means 'off'
|
||||
; available units are s(econd), m(inute), h(hour), or d(day)
|
||||
; default: 0
|
||||
;
|
||||
;request_terminate_timeout = 0s
|
||||
|
||||
; The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
|
||||
; '0s' means 'off'
|
||||
; available units are s(econd), m(inute), h(hour), or d(day)
|
||||
;
|
||||
;request_slowlog_timeout = 0s
|
||||
|
||||
; The log file for slow requests
|
||||
; default: @EXPANDED_LOCALSTATEDIR@/log/php-fpm.log.slow
|
||||
;
|
||||
;slowlog = @EXPANDED_LOCALSTATEDIR@/log/php-fpm.log.slow
|
||||
|
||||
; Set open file desc rlimit
|
||||
; default: system defined value
|
||||
;
|
||||
;rlimit_files = 1024
|
||||
|
||||
; Set max core size rlimit
|
||||
; It could be
|
||||
; - unlimited
|
||||
; - an integer greater or equal to 0
|
||||
; default: system defined value
|
||||
;
|
||||
;rlimit_core = 0
|
||||
|
||||
; Chroot to this directory at the start, absolute path
|
||||
; *** WARNING ***
|
||||
; chrooting is a great security features and should be used whenever it's possible.
|
||||
; However, all php path will be related to the chroot (error_log, sessions.save_path, ...)
|
||||
; When not set, chroot is not used
|
||||
; default: not set
|
||||
;
|
||||
;chroot =
|
||||
|
||||
; Chdir to this directory at the start, absolute path
|
||||
; default: current directory or / when chroot
|
||||
;
|
||||
;chdir = /var/www
|
||||
|
||||
; Redirect workers' stdout and stderr into main error log.
|
||||
; If not set, they will be redirected to /dev/null, according to FastCGI specs
|
||||
; default: no
|
||||
;
|
||||
;catch_workers_output = yes
|
||||
|
||||
; List of ipv4 addresses of FastCGI clients that allowed to connect.
|
||||
; Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
|
||||
; Makes sense only with a tcp listening socket.
|
||||
; Each addresses must be separated by a comma
|
||||
; default: any
|
||||
;
|
||||
;listen.allowed_client = 127.0.0.1
|
||||
|
||||
; Pass environment variables like LD_LIBRARY_PATH
|
||||
; All $VARIABLEs are taken from current environment
|
||||
; default: clean env
|
||||
;
|
||||
;env[HOSTNAME] = $HOSTNAME
|
||||
;env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||
;env[TMP] = /tmp
|
||||
;env[TMPDIR] = /tmp
|
||||
;env[TEMP] = /tmp
|
||||
|
||||
Unix group of processes
|
||||
<value name="group">@php_fpm_group@</value>
|
||||
|
||||
Process manager settings
|
||||
<value name="pm">
|
||||
|
||||
Sets style of controling worker process count.
|
||||
Valid values are 'static' and 'dynamic'
|
||||
<value name="style">static</value>
|
||||
|
||||
Sets the limit on the number of simultaneous requests that will be served.
|
||||
Equivalent to Apache MaxClients directive.
|
||||
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
|
||||
Used with any pm_style.
|
||||
<value name="max_children">50</value>
|
||||
|
||||
Sets the status URI to call to obtain php-fpm status page.
|
||||
If not set, no URI will be recognized as a status page.
|
||||
By default, it returns text/plain looking like:
|
||||
accepted conn: 12073
|
||||
pool: default
|
||||
process manager: static
|
||||
idle processes: 35
|
||||
active processes: 65
|
||||
total processes: 100
|
||||
"accepted conn" : the number of request accepted by the pool
|
||||
"pool" : the name of the pool
|
||||
"process manager": static or dynamic
|
||||
"idle processes": the number of idle processes
|
||||
"active processes": the number of active processes
|
||||
"total processes": idle + active
|
||||
The last three number are uptaded every second.
|
||||
The "accepted conn" is updated in real time
|
||||
*** Output ***
|
||||
By default it returns text/plain
|
||||
But passing as a query string html or json, it will returns
|
||||
the corresponding output syntax:
|
||||
http://www.foo.bar/status
|
||||
http://www.foo.bar/status?json
|
||||
http://www.foo.bar/status?html
|
||||
*** WARNING ***
|
||||
It has to start with a /. It could be named has you want.
|
||||
It's maybe not a good idea to use .php extension to be certain
|
||||
not to conflict with a real PHP file
|
||||
<value name="status">/status</value>
|
||||
|
||||
Set the ping URI to call the monitoring page of php-fpm
|
||||
If not set, no URI will be recognized as a ping page.
|
||||
This could be used to test from outside that php-fpm
|
||||
is alive and responding:
|
||||
- have a graph of php-fpm availability (rrd or such)
|
||||
- remove a server from a pool if it's not responding (load balancing systems)
|
||||
- trigger alerts for the operating team (24/7)
|
||||
*** WARNING ***
|
||||
It has to start with a /. It could be named has you want.
|
||||
It's maybe not a good idea to use .php extension to be certain
|
||||
not to conflict with a real PHP file
|
||||
<value name="ping">/ping</value>
|
||||
Set the response to custom the response of a ping request
|
||||
If 'pong' is not set, the default is "pong".
|
||||
The response is text/plain with a 200 response code
|
||||
<value name="pong">pong</value>
|
||||
|
||||
Settings group for 'dynamic' pm style
|
||||
<value name="dynamic">
|
||||
|
||||
Sets the number of server processes created on startup.
|
||||
Used only when 'dynamic' pm_style is selected
|
||||
<value name="start_servers">20</value>
|
||||
|
||||
Sets the desired minimum number of idle server processes.
|
||||
Used only when 'dynamic' pm_style is selected
|
||||
<value name="min_spare_servers">5</value>
|
||||
|
||||
Sets the desired maximum number of idle server processes.
|
||||
Used only when 'dynamic' pm_style is selected
|
||||
<value name="max_spare_servers">35</value>
|
||||
|
||||
</value>
|
||||
|
||||
</value>
|
||||
|
||||
The timeout (in seconds) for serving a single request after which the worker process will be terminated
|
||||
Should be used when 'max_execution_time' ini option does not stop script execution for some reason
|
||||
'0s' means 'off'
|
||||
<value name="request_terminate_timeout">0s</value>
|
||||
|
||||
The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
|
||||
'0s' means 'off'
|
||||
<value name="request_slowlog_timeout">0s</value>
|
||||
|
||||
The log file for slow requests
|
||||
<value name="slowlog">@EXPANDED_LOCALSTATEDIR@/log/php-fpm.log.slow</value>
|
||||
|
||||
Set open file desc rlimit
|
||||
<value name="rlimit_files">1024</value>
|
||||
|
||||
Set max core size rlimit
|
||||
<value name="rlimit_core">0</value>
|
||||
|
||||
Chroot to this directory at the start, absolute path
|
||||
<value name="chroot"></value>
|
||||
|
||||
Chdir to this directory at the start, absolute path
|
||||
<value name="chdir"></value>
|
||||
|
||||
Redirect workers' stdout and stderr into main error log.
|
||||
If not set, they will be redirected to /dev/null, according to FastCGI specs
|
||||
<value name="catch_workers_output">yes</value>
|
||||
|
||||
How much requests each process should execute before respawn.
|
||||
Useful to work around memory leaks in 3rd party libraries.
|
||||
For endless request processing please specify 0
|
||||
Equivalent to PHP_FCGI_MAX_REQUESTS
|
||||
<value name="max_requests">500</value>
|
||||
|
||||
Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
|
||||
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
|
||||
Makes sense only with AF_INET listening socket.
|
||||
<value name="allowed_clients">127.0.0.1</value>
|
||||
|
||||
Pass environment variables like LD_LIBRARY_PATH
|
||||
All $VARIABLEs are taken from current environment
|
||||
<value name="environment">
|
||||
<value name="HOSTNAME">$HOSTNAME</value>
|
||||
<value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
|
||||
<value name="TMP">/tmp</value>
|
||||
<value name="TMPDIR">/tmp</value>
|
||||
<value name="TEMP">/tmp</value>
|
||||
<value name="OSTYPE">$OSTYPE</value>
|
||||
<value name="MACHTYPE">$MACHTYPE</value>
|
||||
<value name="MALLOC_CHECK_">2</value>
|
||||
</value>
|
||||
|
||||
</section>
|
||||
|
||||
</workers>
|
||||
|
||||
</configuration>
|
||||
; Additional php.ini defines, specific to this pool of workers.
|
||||
; These settings overwrite the values previously defined in the php.ini.
|
||||
; The directives are the same as the php sapi:
|
||||
; - php_value/php_flag: you can set classic ini defines which can be overwriten from PHP call 'ini_set'.
|
||||
; - php_admin_value/php_admin_flag: those directives won't be overwriten by PHP call 'ini_set'
|
||||
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no
|
||||
;
|
||||
; Defining 'extension' will load the corresponding shared extension from extension_dir.
|
||||
; Defining 'disable_functions' or 'disable_classes' won't overwrite previously defined
|
||||
; php.ini value, but the new value will be append.
|
||||
;
|
||||
; default: nothing is defined but the ones in php.ini and at startup with the -d arguement
|
||||
;
|
||||
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -fpool1@my.domain.com
|
||||
;php_flag[display_errors] = off
|
||||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
||||
;php_admin_value[log_errors] = on
|
||||
;php_admin_value[memory_limit] = 32M
|
||||
|
||||
Reference in New Issue
Block a user