Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68341 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92342 invoked from network); 31 Jul 2013 02:00:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2013 02:00:27 -0000 Received: from [127.0.0.1] ([127.0.0.1:5057]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id D9/BC-30402-BBF68F15 for ; Tue, 30 Jul 2013 22:00:27 -0400 Authentication-Results: pb1.pair.com header.from=crrodriguez@opensuse.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=crrodriguez@opensuse.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain opensuse.org from 176.9.56.74 cause and error) X-PHP-List-Original-Sender: crrodriguez@opensuse.org X-Host-Fingerprint: 176.9.56.74 ex6.cdburnerxp.se Received: from [176.9.56.74] ([176.9.56.74:56611] helo=ex6.cdburnerxp.se) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B8/AC-30402-9EA68F15 for ; Tue, 30 Jul 2013 21:39:54 -0400 Received: from ex6.cdburnerxp.se (localhost [127.0.0.1]) by ex6.cdburnerxp.se (Postfix) with ESMTP id D223C1590282; Wed, 31 Jul 2013 03:39:50 +0200 (CEST) To: internals@lists.php.net Cc: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Wed, 31 Jul 2013 03:39:49 +0200 Message-ID: <1375234789-704495-1-git-send-email-crrodriguez@opensuse.org> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [PATCH] =?UTF-8?q?[RESEND]=20sapi/apache2*:=20USe=20the=20correct?= =?UTF-8?q?=20API=20at=C2=B7server=20startup?= From: crrodriguez@opensuse.org (=?UTF-8?q?Cristian=20Rodr=C3=ADguez?=) To proceed with startup at the second load only ap_query_state() must be used in newish versions of apache --- sapi/apache2filter/sapi_apache2.c | 11 +++++++++-- sapi/apache2handler/sapi_apache2.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 8ce490e..c308a29 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -606,11 +606,17 @@ static int php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { + +#if AP_MODULE_MAGIC_AT_LEAST(20110203,1) + /* Apache will load, unload and then reload a DSO module. This + * prevents us from starting PHP until the second load. */ + if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) { + return OK; + } +#else void *data = NULL; const char *userdata_key = "apache2filter_post_config"; - /* Apache will load, unload and then reload a DSO module. This - * prevents us from starting PHP until the second load. */ apr_pool_userdata_get(&data, userdata_key, s->process->pool); if (data == NULL) { /* We must use set() here and *not* setn(), otherwise the @@ -622,6 +628,7 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_cleanup_null, s->process->pool); return OK; } +#endif /* Set up our overridden path. */ if (apache2_php_ini_path_override) { diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index b7f95e0..7c5b498 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -430,12 +430,19 @@ static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp static int php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { - void *data = NULL; - const char *userdata_key = "apache2hook_post_config"; +#if AP_MODULE_MAGIC_AT_LEAST(20110203,1) /* Apache will load, unload and then reload a DSO module. This * prevents us from starting PHP until the second load. */ + if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) { + return OK; + } +#else + void *data = NULL; + const char *userdata_key = "apache2hook_post_config"; + apr_pool_userdata_get(&data, userdata_key, s->process->pool); + if (data == NULL) { /* We must use set() here and *not* setn(), otherwise the * static string pointed to by userdata_key will be mapped @@ -445,6 +452,7 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp apr_pool_userdata_set((const void *)1, userdata_key, apr_pool_cleanup_null, s->process->pool); return OK; } +#endif /* Set up our overridden path. */ if (apache2_php_ini_path_override) { -- 1.8.1.4