.php files see Apache environment variables, .html files don't
Posted
by
dotancohen
on Server Fault
See other posts from Server Fault
or by dotancohen
Published on 2012-08-07T21:27:00Z
Indexed on
2012/09/17
3:40 UTC
Read the original article
Hit count: 522
Consider this environment:
$ cat .htaccess
AddType application/x-httpd-php .php .html
SetEnv Foo Bar
$ cat test.php
<?php
echo "Hello: ";
echo $_SERVER['Foo'];
echo $_ENV['Foo'];
echo getenv('Foo');
?>
$ cat test.html
<?php
echo "Hello: ";
echo $_SERVER['Foo'];
echo $_ENV['Foo'];
echo getenv('Foo');
?>
This is the output of test.php
:
Hello BarBarBar
This is the output of test.html
:
Hello
Why might that be? How might I fix it?
Here is phpinfo.php
:
http://pastebin.com/rgq7up61
Here is phpinfo.html
:
http://pastebin.com/VUKFNZ36
If anyone knows where I can host a real webpage instead of just the HTML for one, please let me know and I'll move the content to there. Thanks.
© Server Fault or respective owner