static int fpm_conf_post_process(int force_daemon) /* {{{ */ { struct fpm_worker_pool_s *wp; if (fpm_global_config.pid_file) { fpm_evaluate_full_path(&fpm_global_config.pid_file, NULL, PHP_LOCALSTATEDIR, 0); } if (force_daemon >= 0) { /* forced from command line options */ fpm_global_config.daemonize = force_daemon; } fpm_globals.log_level = fpm_global_config.log_level; zlog_set_level(fpm_globals.log_level); if (fpm_global_config.process_max < 0) { zlog(ZLOG_ERROR, "process_max can't be negative"); return -1; } if (fpm_global_config.process_priority != 64 && (fpm_global_config.process_priority < -19 || fpm_global_config.process_priority > 20)) { zlog(ZLOG_ERROR, "process.priority must be included into [-19,20]"); return -1; } if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup("log/php-fpm.log"); } #ifdef HAVE_SYSTEMD if (0 > fpm_systemd_conf()) { return -1; } #endif #ifdef HAVE_SYSLOG_H if (!fpm_global_config.syslog_ident) { fpm_global_config.syslog_ident = strdup("php-fpm"); } if (fpm_global_config.syslog_facility < 0) { fpm_global_config.syslog_facility = LOG_DAEMON; } if (strcasecmp(fpm_global_config.error_log, "syslog") != 0) #endif { fpm_evaluate_full_path(&fpm_global_config.error_log, NULL, PHP_LOCALSTATEDIR, 0); } if (0 > fpm_stdio_open_error_log(0)) { return -1; } if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) { return -1; } if (0 > fpm_conf_process_all_pools()) { return -1; } if (0 > fpm_log_open(0)) { return -1; } for (wp = fpm_worker_all_pools; wp; wp = wp->next) { if (!wp->config->access_log || !*wp->config->access_log) { continue; } if (0 > fpm_log_write(wp->config->access_format)) { zlog(ZLOG_ERROR, "[pool %s] wrong format for access.format '%s'", wp->config->name, wp->config->access_format); return -1; } } return 0; }
static int fpm_conf_post_process(TSRMLS_D) /* {{{ */ { struct fpm_worker_pool_s *wp; if (fpm_global_config.pid_file) { fpm_evaluate_full_path(&fpm_global_config.pid_file, NULL, PHP_LOCALSTATEDIR, 0); } fpm_globals.log_level = fpm_global_config.log_level; if (fpm_global_config.process_max < 0) { zlog(ZLOG_ERROR, "process_max can't be negative"); return -1; } if (!fpm_global_config.error_log) { fpm_global_config.error_log = strdup("log/php-fpm.log"); } #ifdef HAVE_SYSLOG_H if (!fpm_global_config.syslog_ident) { fpm_global_config.syslog_ident = strdup("php-fpm"); } if (fpm_global_config.syslog_facility < 0) { fpm_global_config.syslog_facility = LOG_DAEMON; } if (strcasecmp(fpm_global_config.error_log, "syslog") != 0) #endif { fpm_evaluate_full_path(&fpm_global_config.error_log, NULL, PHP_LOCALSTATEDIR, 0); } if (0 > fpm_stdio_open_error_log(0)) { return -1; } if (0 > fpm_log_open(0)) { return -1; } if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) { return -1; } if (0 > fpm_conf_process_all_pools()) { return -1; } for (wp = fpm_worker_all_pools; wp; wp = wp->next) { if (!wp->config->access_log || !*wp->config->access_log) { continue; } if (0 > fpm_log_write(wp->config->access_format TSRMLS_CC)) { zlog(ZLOG_ERROR, "[pool %s] wrong format for access.format '%s'", wp->config->name, wp->config->access_format); return -1; } } return 0; }