XSSI Library

On This Page

Troubleshooting problems with XSSI commands.

General Troubleshooting with XSSIs

Some times it seems like things that should work simply don't. You can pull your hair out for hours and realize what the hell happened was you forgot a quotation mark. Three hours down the drain and you've got to launch in 12 hours. Well, not all your problems will be answered here, but there are a few things you should look at to make sure everything is working right.

Symptom: The page comes up without the intended effect no where to be seen and the XSSI command is visable in the "View Source" output.

Are you sure your server is running?
Check another page, other than one you are working on to verify that your server is actually up and running, and be sure to make sure your browser isn't just pulling the page you're testing out of it's cache! (In Netscape hold down [Option] or [Alt] while hitting 'Reload'.)

Was the 'mod_include' file compiled in with Apache?
Only the person who set-up the server will know this. If that's not you, you better find out who it was. If that is you, then you shouldn't be reading this question.

Has the file you are working with had its X-bit set?
The default configuration for SSI's requires that the file with SSI commands has it's execute bit set in it's permissions. Go ahead and say 'chmod +x filename.html', just to be sure.

Has the filename's extension been set correctly?
Your server may require that you have a specific extension added to the name of the file you are using. The default is '.shtml', although I use '.html' because I find that it's distracting to have other extensions in the name. (I make sure that I keep my x-bits in order to keep the server from parsing _every_ page.)

Symptom: The page comes up with an error similar to: "[an error occurred while processing this directive]"

Is your server using the latest version of Apache?
After personal experience, check to make sure that the version of Apache you are working with is 1.2 or later. Version 1.2 added the commands that are beyond the original NCSA SSI's, known as XSSI's. These extensions include flow control commands like #If, #elseif, and #endif.

Site:

Have you formed the HTML comment correctly?
View the page in you browser of choice. If the commands that you have in the page are showing up in your rendered HTML page, then you need to recheck to make sure that you have "<!--" at the start of your command, and "-->" at the end.

Have you formed the SSI command correctly?
In "CGI Programming on the World Wide Web" by Shishir Gundavaram and published by O'Reilly, on the very last page of chapter 5, two common errors are pointed out:

First, You should not forget the '#' sign:
<!--echo var="REMOTE_USER" -->

Second, do not add extra spaces between the "-" sign and the "#" character:
<!-- #echo var="REMOTE_USER" -->

If you make either of these two mistakes, the server will not give you an error; rather it will treat the whole expression as an HTML comment.

It's also a good idea to add a space just before the end of the command like so: " -->"

Remember: if your command is formed right and your server is configured correctly, then the actual XSSI command will NOT show up in either the rendered HTML or the "View Source" output from your browser's rendering of the page.

Are your commands and variables spelled correctly?
I've caught myself doing this far too many times. Go over your command letter by letter, making sure that it's spelled correctly and that quotation marks are in the right place.

Are you accessing the URL correctly?
On some versions of Apache (and maybe other servers), if you have a URL that points to a file, but ends in a slash (/), the page will display, but the SSIs will break. This can occur when editing <A HREF>s by hand: "http://www.foo.com/bar.html/"

Any other suggestions?
If you're still stuck, then you problably have a problem with what you are expecting the command to do. Remember this is like trouble shooting anything in the world: break it down to the simplest pieces, and find out _exactly_ the line that causing you problems.

   

A printer-friendly version of this article is available.
This site hand-coded for your protection.