SSI #set variable and #echo issue

David Weng picture David Weng · Nov 2, 2010 · Viewed 9k times · Source

I have a simple .shtml file that I have declared a variable in it.

<!--#set var="testVar" value="12345" -->

But when I want to print the value using

<!--#echo var="testVar" -->

it says

Variable 'testVar' cannot be found

What's the problem? I'm using IIS 7.5 and I also tested in on Apache2 but it's not working either!

Answer

Craig Myles picture Craig Myles · Oct 8, 2013

This works fine for me:

<!--#set var="testVar" value="12345" -->
<!--#echo var="testVar" -->

Do you have Apache configured correctly? You may need to turn on mod_include. The following code should output the date once configured properly:

<!--#echo var="DATE_LOCAL" -->