Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This might be more HTML related but it is a problem with CGI and I know you people know.

I have a contact.html file which is calling contact.cgi with

<!--#include file="cgi-bin/contact.cgi"-->
but it's not loading. When I view the source code I see that line literally sitting there. The whole include line is there.

What could be the problem?

Replies are listed 'Best First'.
Re: including a CGI file
by bibo (Pilgrim) on Oct 10, 2004 at 04:19 UTC
Re: including a CGI file
by tachyon (Chancellor) on Oct 10, 2004 at 04:32 UTC

    The virtual variable is used to specify a file path/name relative to the base directory of the HTTP server. The file variable is used to specify a file path/name relative to the directory of the current document.

    file="cgi-bin/contact.cgi" is relative to the directory of the current document, so if you are at http://domain.com/path/doc.htm then this will effectively be /path/cgi-bin/contact.cgi. I think you want <!--#include virtual="cgi-bin/contact.cgi"--> so you get /cgi-bin/contact.cgi

    Alternatively you may need <!--#exec cgi="some_cgi" --> to get it to work.

    As already noted SSI needs to be enabled in either a .htaccess file or httpd.conf itself.

    # this may work Options +Includes AddHandler server-parsed .html # or this Options Indexes FollowSymLinks Includes AddType application/x-httpd-cgi .cgi AddType text/x-server-parsed-html .html
Re: including a CGI file
by Zaxo (Archbishop) on Oct 10, 2004 at 04:13 UTC

    Are .html files handled by SSI? Usually not. You are probably not working with your httpd configuration correctly.

    After Compline,
    Zaxo

Re: including a CGI file
by gloryhack (Deacon) on Oct 10, 2004 at 18:01 UTC
    See: SSI For The Rest Of us. It's worth a look if you want to get up and running with Server Side Includes quickly.