I'm working on getting mod_fastcgi/apache2/php4.3 to work together 
smoothly.  One thing mod_fastcgi does is, when it starts the fastcgi 
processes (php in this instance) very little environment is given to the 
process.  The environment is sent via the fastcgi protocol for each 
request.  To deal with this a hacky overwriting of the environment was 
done on every request.  Other than being a hack, it was also a memory 
leak.  I've fixed that by introducing a way for me to override the 
php_import_environment_variables function in PHP.  This should introduce 
no side effects for anyone, but I want to pass the patch by dev before 
commiting.  I've finished my patches to cgi_main.c, but those patches 
require this.

Shane


Index: php_variables.c
===================================================================
RCS file: /repository/php4/main/php_variables.c,v
retrieving revision 1.44
diff -u -d -u -r1.44 php_variables.c
--- php_variables.c     8 Sep 2002 00:27:05 -0000       1.44
+++ php_variables.c     13 Oct 2002 07:26:09 -0000
@@ -28,6 +28,9 @@

  #include "zend_globals.h"

+/* for systems that need to override reading of environment variables */
+void _php_import_environment_variables(zval *array_ptr TSRMLS_DC);
+PHPAPI void (*php_import_environment_variables)(zval *array_ptr 
TSRMLS_DC) = _php_import_environment_variables;

  PHPAPI void php_register_variable(char *var, char *strval, zval 
*track_vars_array TSRMLS_DC)
  {
@@ -318,8 +321,7 @@
        }
  }

-
-void php_import_environment_variables(zval *array_ptr TSRMLS_DC)
+void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
  {
        char **env, *p, *t;

Index: php_variables.h
===================================================================
RCS file: /repository/php4/main/php_variables.h,v
retrieving revision 1.13
diff -u -d -u -r1.13 php_variables.h
--- php_variables.h     11 Dec 2001 15:31:05 -0000      1.13
+++ php_variables.h     13 Oct 2002 07:26:09 -0000
@@ -31,7 +31,7 @@
  #define PARSE_STRING 3

  void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC);
-PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC);
+extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr 
TSRMLS_DC);
  PHPAPI void php_register_variable(char *var, char *val, pval 
*track_vars_array TSRMLS_DC);
  /* binary-safe version */
  PHPAPI void php_register_variable_safe(char *var, char *val, int 
val_len, pval *track_vars_array TSRMLS_DC);


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to