summaryrefslogtreecommitdiff
path: root/sapi/apache/php_apache.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/apache/php_apache.c')
-rw-r--r--sapi/apache/php_apache.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c
index 95d31afe91..8cff77e6c4 100644
--- a/sapi/apache/php_apache.c
+++ b/sapi/apache/php_apache.c
@@ -68,6 +68,7 @@ PHP_FUNCTION(apachelog);
PHP_FUNCTION(apache_note);
PHP_FUNCTION(apache_lookup_uri);
PHP_FUNCTION(apache_child_terminate);
+PHP_FUNCTION(apache_setenv);
PHP_MINFO_FUNCTION(apache);
@@ -77,6 +78,7 @@ function_entry apache_functions[] = {
PHP_FE(apache_note, NULL)
PHP_FE(apache_lookup_uri, NULL)
PHP_FE(apache_child_terminate, NULL)
+ PHP_FE(apache_setenv, NULL)
{NULL, NULL, NULL}
};
@@ -357,6 +359,28 @@ PHP_FUNCTION(getallheaders)
}
/* }}} */
+/* {{{ proto int apache_setenv(string variable, string value [, boolean walk_to_top])
+ Set an Apache subprocess_env variable */
+PHP_FUNCTION(apache_setenv)
+{
+ int var_len, val_len, top=0;
+ char *var = NULL, *val = NULL;
+ request_rec *r = (request_rec *) SG(server_context);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &var, &var_len, &val, &val_len, &top) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ while(top) {
+ if(r->prev) r = r->prev;
+ else break;
+ }
+
+ ap_table_setn(r->subprocess_env, ap_pstrndup(r->pool, var, var_len), ap_pstrndup(r->pool, val, val_len));
+ RETURN_TRUE;
+}
+/* }}} */
+
/* {{{ proto class apache_lookup_uri(string URI)
Perform a partial request of the given URI to obtain information about it */
PHP_FUNCTION(apache_lookup_uri)