fpm_main
2015-10-26 22:05:55 0 举报
fpm_main是一个用于安装、配置和管理FPM(FastCGI Process Manager)的主程序。FPM是一个PHP FastCGI应用程序管理器,它提供了一种简单而有效的方式来管理和控制PHP应用程序的执行。通过fpm_main,用户可以创建、启动、停止和重启FPM进程,以及管理FPM的配置文件和日志文件。此外,fpm_main还提供了一些高级功能,如负载均衡和故障切换,以确保PHP应用程序的高可用性和性能。总之,fpm_main是Linux系统管理员和维护人员管理PHP应用程序的重要工具之一。
作者其他创作
大纲/内容
cgi_sapi_module.php_ini_path_override = NULL; cgi_sapi_module.php_ini_ignore_cwd = 1;
static void fcgi_setup_signals(void)
/* set up version */zend_version_info = strdup(ZEND_CORE_VERSION_INFO);zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO) - 1;
sapi_initialize_empty_request(TSRMLS_C);
char *tmp = getenv(\"USE_ZEND_ALLOC\");
sf-ini_entries = NULL;sapi_module = *sf;
php_setup_sapi_content_types(TSRMLS_C);
/* {{{ void php_output_startup(void) * Set up module globals and initalize the conflict and reverse conflict hash tables */PHPAPI void php_output_startup(void)
init lots of SG shit
/* startup after we get the above ini override se we get things right */ if (cgi_sapi_module.startup(&cgi_sapi_module) == FAILURE) {
sapi_globals_ctor(&sapi_globals);
return sapi_cgibin_getenv((char *) \"HTTP_COOKIE\
case 'i': /* php info & quit */php_information = 1;
zend_startup_extensions_mechanism();
if(post_reader_func) {post_reader_func(TSRMLS_C);
static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC)
zend_init_rsrc_list_dtors();
/* Cookies */SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C);
SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries TSRMLS_DC)
SG(request_info).content_type_dup = content_type;
for (x = 0; x pstorage) / sizeof(*zend_signal_globals-pstorage); ++x) { zend_signal_queue_t *queue = &zend_signal_globals-pstorage[x];
start_memory_manager(TSRMLS_C);
static void zend_signal_globals_ctor(zend_signal_globals_t *zend_signal_globals TSRMLS_DC)
if (sapi_module.input_filter_init) {sapi_module.input_filter_init(TSRMLS_C);
static void sapi_read_post_data(TSRMLS_D)
if (sapi_module.activate) {sapi_module.activate(TSRMLS_C);
case 'm': /* list compiled in modules */print_modules(TSRMLS_C);print_extensions(TSRMLS_C);
php_output_startup();
is_initialized = 1;
zend_signal_globals_ctor(&zend_signal_globals);
alloc_globals_ctor(&alloc_globals);
cgi_sapi_module.additional_functions = additional_functions; cgi_sapi_module.executable_location = argv[0];
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
static int sapi_cgi_activate(TSRMLS_D)
sapi_module = *sf;
SAPI_API void sapi_initialize_empty_request(TSRMLS_D)
zend_utility_functions zuf;zuf.error_function = php_error_cb;zuf.printf_function = php_printf;zuf.write_function = php_output_wrapper;zuf.fopen_function = php_fopen_wrapper_for_zend;
case 'c':cgi_sapi_module.php_ini_path_override = strdup(php_optarg);
fcgi_init();
zend_opcode_handlers = (opcode_handler_t*)labels;
virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
int fcgi_init(void)
if (read_bytes buflen) {SG(post_read) = 1; return read_bytes;
if (sapi_module.read_post) {
static inline void php_output_init_globals(zend_output_globals *G)
php_optind = orig_optind; php_optarg = orig_optarg;
int zend_init_rsrc_list_dtors(void)
SAPI_API void sapi_startup(sapi_module_struct *sf)
if (php_information) {
void zend_init_opcodes_handlers(void)
/* No other args are permitted here as there is no interactive mode */ if (argc != php_optind) {
sapi_startup(&cgi_sapi_module);
ZEND_API zend_mm_heap *zend_mm_startup(void)
sapi_post_entry *p=post_entries;while (p-content_type) { if (sapi_register_post_entry(p TSRMLS_CC) == FAILURE) {
SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
fcgi_request *request = (fcgi_request*) SG(server_context);char *request_body_filename = sapi_cgibin_getenv((char *) \"REQUEST_BODY_FILE\
if ((SG(post_max_size) 0) && (SG(request_info).content_length SG(post_max_size))) {
if (module_initialized) {return SUCCESS;
int zend_startup_extensions_mechanism()
static char *sapi_cgi_read_cookies(TSRMLS_D)
static void fcgi_signal_handler(int signo) if (signo == SIGUSR1 || signo == SIGTERM) { in_shutdown = 1;
static int php_cgi_startup(sapi_module_struct *sapi_module)
php_output_direct = php_output_stdout;
zend_signal_startup();
alloc_globals-mm_heap = zend_mm_startup();
ZEND_API void start_memory_manager(TSRMLS_D)
zend_init_opcodes_handlers();
SG(server_context) = NULL; SG(request_info).request_method = NULL; SG(request_info).auth_digest = SG(request_info).auth_user = SG(request_info).auth_password = NULL; SG(request_info).content_type_dup = NULL;
sapi_register_post_entries(php_post_entries TSRMLS_CC);
/* Called from php_request_startup() for every request.*/ SAPI_API void sapi_activate(TSRMLS_D)
zend_startup_strtod();
module_shutdown = 0; module_startup = 1;
zend_compile_file = compile_file;zend_execute_ex = execute_ex;zend_execute_internal = NULL;
SG(read_post_bytes) += read_bytes;
/* Set up utility functions and values */zend_error_cb = utility_functions-error_function;zend_printf = utility_functions-printf_function;zend_write = (zend_write_func_t) utility_functions-write_function;zend_fopen = utility_functions-fopen_function;
/* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */ if (!SG(request_info).path_translated) {return FAILURE;
case 'n':cgi_sapi_module.php_ini_ignore = 1;
sapi_activate(TSRMLS_C);
if(sapi_module.default_post_reader) {sapi_module.default_post_reader(TSRMLS_C);
php_stream_rewind(SG(request_info).request_body);
void zend_signal_startup()
int php_setup_sapi_content_types(TSRMLS_D)
case 'y':fpm_config = php_optarg;
SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
zend_output_globals output_globals;php_output_init_globals(output_globals)
0 条评论
下一页