cvs: php4 /sapi/apache2filter sapi_apache2.c
| From: | Aaron Bannert | Date: | Wed, 24 Apr 2002 00:55:38 +0000 |
| Subject: | cvs: php4 /sapi/apache2filter sapi_apache2.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11371@lists.php.net to get a copy of this message | ||
aaron Tue Apr 23 20:55:38 2002 EDT
Modified files:
/php4/sapi/apache2filter sapi_apache2.c
Log:
Apache does a full load, unload, load cycle for each DSO module.
This patch makes sure that any startup actions that are performed
for PHP don't happen until the second load (the second call to
the post_config hook), and it also prevents subsequent calls
to the initialization routines.
Suggested By: Cliff Woolley
PR: 16475, 16754
Index: php4/sapi/apache2filter/sapi_apache2.c
diff -u php4/sapi/apache2filter/sapi_apache2.c:1.73 php4/sapi/apache2filter/sapi_apache2.c:1.74
--- php4/sapi/apache2filter/sapi_apache2.c:1.73 Thu Apr 18 18:10:57 2002
+++ php4/sapi/apache2filter/sapi_apache2.c Tue Apr 23 20:55:38 2002
@@ -447,6 +447,23 @@
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 = "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) {
+ apr_pool_userdata_setn((const void *)1, userdata_key,
+ apr_pool_cleanup_null, s->process->pool);
+ return OK;
+ }
+ else if (data == (const void *)2) {
+ return OK;
+ }
+ apr_pool_userdata_setn((const void *)2, userdata_key,
+ apr_pool_cleanup_null, s->process->pool);
+
/* Set up our overridden path. */
if (apache2_php_ini_path_override) {
apache2_sapi_module.php_ini_path_override = apache2_php_ini_path_override;