Re: Mixed PHP/SSI and environment variables

From: Date: Fri, 28 Oct 2005 11:22:32 +0000
Subject: Re: Mixed PHP/SSI and environment variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-224768@lists.php.net to get a copy of this message
Christoph Freundl wrote:
Hello, I have a problem with the persistence of environment variables when mixing PHP and SSI (Apache) and I am not sure if I just made an error or if this approach cannot work at all. So please consider the following files: setvar.shtml ------------------------------------------------- <!--#set var="myvar" value="myval" --> ------------------------------------------------- showvar.php ------------------------------------------------- <?php echo apache_getenv( "myvar" ); ?> ------------------------------------------------- info.shtml ------------------------------------------------- <!--#include virtual="setvar.shtml" --> <!--#include virtual="showvar.php" --> ------------------------------------------------- info.php ------------------------------------------------- <?php virtual( "setvar.shtml" );
have yuou tried include/require here instead of virtual() I imagine that the env of the subprocess wouldn't affect the env of the parent process - i.e. to me it makes sense if you say the env var in the subprocess is not available in the parent process.
echo apache_getenv( "myvar" ); ?> ------------------------------------------------- What I would expect is that you get the same result if you call info.shtml and info.php. What happens when I tried (PHP 4.3.10 with both Apache 1.3.33 and 2.0.53): the shtml shows the variable but the php does not, it seems to "forget" the variable set in setvar.shtml. Please, can anybody tell me what is going wrong here? Regards, Christoph


« previous php.general (#224768) next »