I have been using the SetEnv directive in my htaccess files. So far its worked fine. Today I tried to use the same technique in a different dir/domain and it doesn’t work…The other directives of the htaccess file seem to be picked up so I don’t get the sense that the htaccess is bad, but is it possible the server only refreshes env vars occasionally? Seems contrary to my experience of apache, but I don’t really understand why the same htaccess lines work in one place and not another…

The htaccess has this:
SetEnv SAMBAINCLUDE /home/byosmosis2/

And the test page ( has this:

<? include(getenv("SAMBAINCLUDE")); print "main_incl = $main_include. done...

"; ?>

And the output is this:

Warning: main(): Failed opening ‘’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/.fiery/byosmosis2/ on line 3
main_incl = . done…

Any ideas?



SO here’s another wierd piece of info on this problem…

I also have the following in my htaccess which makes html behave like php:

AddType application/x-httpd-php .html

The wierd part is that that when I copy the test.php file to test.html it works perfectly, but when its a .php it doesn’t do the include. Any ideas on why it behaves as such?




Looks like you answered your own question.
As you pointed out, your .htaccess file contains the directive that tells your apache webserver which file extensions to process as PHP. In this case it’s set to interpret only .html files as PHP.

You can add or modify that directive to anything you want. Here’s an example that would process any file with one of the four file extensions as PHP.

AddType application/x-httpd-php .html .php3 .php .phtml

Right on…


Thanks for your reply!!!

Well, I had/have the .php extension in the htaccess file too:

AddType application/x-httpd-php .html .php .sdd

And though the .html and .sdd (just for fun those are my initials!) extensions work fine, the .php extension doesn’t work…that’s why I was so surprised. Is it possible the .php extension is pre-defined and/or only can read whats at the server level and not the htaccess file?


Thanks again, all the best!


PS - Do you like samba music? Check out Batucada do Leste: