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还提供了一些高级功能,如设置FPM进程的用户和组、配置FPM进程的参数等。总之,fpm_main是管理PHP应用程序的重要工具,它可以帮助用户更有效地控制和管理PHP应用程序的运行环境。
作者其他创作
大纲/内容
static void fcgi_setup_signals(void)
sapi_initialize_empty_request(TSRMLS_C);
char *tmp = getenv(\"USE_ZEND_ALLOC\");
php_startup_ticks(TSRMLS_C);
/* Register Zend ini entries */zend_register_standard_ini_entries(TSRMLS_C);
if (sapi_module.php_ini_path_override) {
void zend_interned_strings_init(TSRMLS_D)
/*Find and open actual ini file
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) {
gc_globals_ctor_ex(&gc_globals);
/* Add environment location */env_location = getenv(\"PHPRC\
case 'i': /* php info & quit */php_information = 1;
zend_startup_builtin_functions(TSRMLS_C);
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();
const zend_ini_entry *p = ini_entry;HashTable *directives = registered_zend_ini_directives;
/* Cookies */SG(request_info).cookie_data = sapi_module.read_cookies(TSRMLS_C);
/* Register PHP core ini entries */REGISTER_INI_ENTRIES();
SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries TSRMLS_DC)
static void sapi_read_post_data(TSRMLS_D)
/* default compile-time values */CG(asp_tags) = asp_tags_default;CG(short_tags) = short_tags_default;CG(compiler_options) = compiler_options_default;
case 'm': /* list compiled in modules */print_modules(TSRMLS_C);print_extensions(TSRMLS_C);
is_initialized = 1;
zend_signal_globals_ctor(&zend_signal_globals);
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC)
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)
sapi_module = *sf;
int php_init_config(TSRMLS_D)
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;
/* Otherwise search for php-%sapi-module-name%.ini file in search path */if (!fh.handle.fp) {const char *fmt = \"php-%s.ini\
php_ini_file_name = sapi_module.php_ini_path_override;php_ini_search_path = sapi_module.php_ini_path_override;free_ini_search_path = 0;
fcgi_init();
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) {
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
sapi_startup(&cgi_sapi_module);
void zend_register_standard_ini_entries(TSRMLS_D)
REGISTER_MAIN_LONG_CONSTANT(\"E_ERROR\
SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
static void gc_globals_ctor_ex(zend_gc_globals *gc_globals TSRMLS_DC)
if (module_initialized) {return SUCCESS;
int zend_startup_extensions_mechanism()
static char *sapi_cgi_read_cookies(TSRMLS_D)
zend_signal_startup();
ZEND_API void start_memory_manager(TSRMLS_D)
zend_init_opcodes_handlers();
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();
php_binary_init(TSRMLS_C);REGISTER_MAIN_STRINGL_CONSTANT(\"PHP_BINARY\
EG(user_error_handler) = NULL;EG(user_exception_handler) = NULL;、zend_interned_strings_init(TSRMLS_C);
php_scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
module_shutdown = 0; module_startup = 1;
SG(read_post_bytes) += read_bytes;
static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p TSRMLS_DC)
static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p TSRMLS_DC)
PHPAPI void php_output_register_constants(TSRMLS_D)
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)
cgi_sapi_module.php_ini_path_override = NULL; cgi_sapi_module.php_ini_ignore_cwd = 1;
/* set up version */zend_version_info = strdup(ZEND_CORE_VERSION_INFO);zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO) - 1;
sf-ini_entries = NULL;sapi_module = *sf;
static void zend_set_default_compile_time_values(TSRMLS_D)
void php_rfc1867_register_constants(TSRMLS_D)
void zend_register_standard_constants(TSRMLS_D)
php_setup_sapi_content_types(TSRMLS_C);
zend_ini_startup(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)
REGISTER_MAIN_LONG_CONSTANT(\"UPLOAD_ERR_OK\
sapi_globals_ctor(&sapi_globals);
return sapi_cgibin_getenv((char *) \"HTTP_COOKIE\
/*Prepare search path
ZEND_API void gc_globals_ctor(TSRMLS_D)
zend_startup_extensions_mechanism();
EG(bailout) = NULL;EG(error_reporting) = E_ALL & ~E_NOTICE;EG(active_symbol_table) = NULL;PG(header_is_being_sent) = 0; SG(request_info).headers_only = 0; SG(request_info).argv0 = NULL;SG(request_info).argc=0;SG(request_info).argv=(char **)NULL;PG(connection_status) = PHP_CONNECTION_NORMAL;PG(during_request_startup) = 0; PG(last_error_message) = NULL;PG(last_error_file) = NULL;PG(last_error_lineno) = 0; EG(error_handling) = EH_NORMAL;EG(exception_class) = NULL;PG(disable_functions) = NULL;PG(disable_classes) = NULL;EG(exception) = NULL;EG(objects_store).object_buckets = NULL;
int module_number = 0;REGISTER_INI_ENTRIES();
gc_globals_ctor(TSRMLS_C);
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];
Y
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);
zend_builtin_module.module_number = 0;zend_builtin_module.type = MODULE_PERSISTENT;return (EG(current_module) = zend_register_module_ex(&zend_builtin_module TSRMLS_CC)) == NULL ? FAILURE : SUCCESS;
if (sapi_module.activate) {sapi_module.activate(TSRMLS_C);
//Form-based File Upload in HTMLphp_rfc1867_register_constants(TSRMLS_C);
php_output_startup();
ZEND_API int zend_ini_startup(TSRMLS_D)
php_output_register_constants(TSRMLS_C);
static int sapi_cgi_activate(TSRMLS_D)
case 'c':cgi_sapi_module.php_ini_path_override = strdup(php_optarg);
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;
/* If SAPI does not want to ignore all ini files OR an overriding file/path is given.* This allows disabling scanning for ini files in the PHP_CONFIG_FILE_SCAN_DIR but still* load an optional ini file. */if (!sapi_module.php_ini_ignore || sapi_module.php_ini_path_override) {
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) {
/* Check for PHP_INI_SCAN_DIR environment variable to override/set config file scan directory */php_ini_scanned_path = getenv(\"PHP_INI_SCAN_DIR\");if (!php_ini_scanned_path) { /* Or fall back using possible --with-config-file-scan-dir setting (defaults to empty string!) */php_ini_scanned_path = PHP_CONFIG_FILE_SCAN_DIR;php_ini_scanned_path_len = strlen(php_ini_scanned_path);
/* Scan and parse any .ini files found in scan path if path not empty. */if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) {
zend_register_auto_global(\"GLOBALS\
PG(php_binary) = binary_location;
fcgi_request *request = (fcgi_request*) SG(server_context);char *request_body_filename = sapi_cgibin_getenv((char *) \"REQUEST_BODY_FILE\
REGISTER_MAIN_LONG_CONSTANT(\"PHP_OUTPUT_HANDLER_START\
if ((SG(post_max_size) 0) && (SG(request_info).content_length SG(post_max_size))) {
N
zend_set_default_compile_time_values(TSRMLS_C);
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;
alloc_globals-mm_heap = zend_mm_startup();
zend_register_standard_constants(TSRMLS_C);
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;
static void php_binary_init(TSRMLS_D)
zend_compile_file = compile_file;zend_execute_ex = execute_ex;zend_execute_internal = NULL;
ini_scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
if (sapi_module.ini_defaults) {sapi_module.ini_defaults(&configuration_hash);
/* 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;
int zend_startup_builtin_functions(TSRMLS_D)
/* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */ if (!SG(request_info).path_translated) {return FAILURE;
zend_register_constant(&c TSRMLS_CC);
while (p-name) {
int php_startup_ticks(TSRMLS_D)
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);
/* Register constants */REGISTER_MAIN_STRINGL_CONSTANT(\"PHP_VERSION\
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;
0 条评论
下一页