array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.apache-setenv.php', 1 => 'apache_setenv', ), 'up' => array ( 0 => 'ref.apache.php', 1 => 'Apache Functions', ), 'prev' => array ( 0 => 'function.apache-response-headers.php', 1 => 'apache_response_headers', ), 'next' => array ( 0 => 'function.getallheaders.php', 1 => 'getallheaders', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/apache/functions/apache-setenv.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
apache_setenv — Set an Apache subprocess_env variable
apache_setenv() sets the value of the Apache
environment variable specified by
variable
.
Note:
When setting an Apache environment variable, the corresponding $_SERVER variable is not changed.
variable
The environment variable that's being set.
value
The new variable
value.
walk_to_top
Whether to set the top-level variable available to all Apache layers.
Example #1 Setting an Apache environment variable using apache_setenv()
<?php
apache_setenv("EXAMPLE_VAR", "Example Value");
?>
Note:
apache_setenv() can be paired up with apache_getenv() across separate pages or for setting variables to pass to Server Side Includes (.shtml) that have been included in PHP scripts.