Help. Cannot include .cgi files in my shtml :(

software development


I am trying to include an html where I put in a .cgi file outputed unto my main index.shtml. I have no idea on how to do this. I have tried creating .htaccess and put it together in my index.shtml but still have no luck. The page keep displaying the following message error: [an error occurred while processing this directive].

Please help. I have this in my .htaccess file:

Options Includes
AddType text/html shtml
AddHandler server-parsed shtml

This is inside my .cgi file:


use strict;
use CGI qw(:standard);

print header;
print h3(‘Random quotes’);
print p(‘Hello World.’);


Can you got the file yourself? Ie, can you bring it up properly in the browser?

If that works, then it’s an error with your include statement within the file. SSIs are getting parsed, so your .htaccess is correct. You can cross that off your list.

yerba# rm -rf /etc


when I run the .cgi by itself, it run like its suppose to. When I use the include, it is showing this error:

Generate using /cgi-bin/helloworld.cgi - > [an error occurred while processing this directive]
Generate using echo DATE_LOCAL - > Tuesday, 20-Jun-2006 22:16:15 PDT


What do you mean by running it by itself? It’s very important that it runs if you access it via the browser:

What does your SSI directive look like?

As I said before, the SSI is parsing. It can ONLY be One of two problems:

  • Script isn’t running
  • SSI directive is incorrect

That’s it. Those are the only two possible problems.

yerba# rm -rf /etc


Are you using include virtual or include file to run the SSI directive? You probably need to use include virtual.


Yes what I meant when running itself is by going to It runs like it suppose to.

The code that did not work was:

The code that works (have to use virtual like periwinkle said)


awesome - glad to have helped.