Apache CGI Works alone, but not in HTM file

Posted on 1999-07-09
Medium Priority
Last Modified: 2013-12-25
I'm migrating from a WN server to an Apache server. I have several scripts which ran fine on WN, but on Apache, they don't.  

In order to attempt to understand what's going wrong, I downloaded the simplest CGI I could find - a text counter (countit.cgi).  I was able to set it up and get it to work on its own eg, http://www.blah.com/countit.cgi, however, if I try to get the text embeded in an HTML file, nothing gets returned.  When I look at what the server returned inside the HTML file, I see that it didn't do anything with the exec statement.  I also tried the include virtual as listed in the apache.org docs on the subject (i.e., <!--#include virtual="cgi-bin/counter/countit.cgi" --> ) and that did the same thing, the text <!--#include...etc.. is included in the HTML returned, and not interpreted by PERL.

What's goin' on here?

Question by:Bigpaws

Accepted Solution

djsansui earned 400 total points
ID: 1834968
Are you setting up the Apache server?  If so there are several things you must do to make SSI work.

in httpd.conf, you must add:
    Options Includes
to the base directory settings (it looks like <Directory "c:/htdocs"> or whatever is the location of your web folder)

Then uncomment the lines:
AddHandler server-parsed .shtml
AddType    text/html     shtml

you should be all set to use SSI then.  If you are new to Apache, I suggest you read httpd.conf to learn a little bit about what you can do with it.  You'll probably stumble upon dozens of useful features.

also, I've had more luck using the directive <!--#exec cgi="/cgi-bin/start2.cgi" --> than the include directives (when executing a CGI). Good luck, you should be parsing in no time.

Author Comment

ID: 1834969
I'm not actually the one setting it up.  Does this mean, once I get the admin to set it up, all the files have to be named .shtml?  

Expert Comment

ID: 6873127

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

Thank you,
Moderator @ Experts Exchange

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In an Exchange Crossforest migration, the distribution groups can be a very complex operation that would cause loss of time, lots of issues and continued headaches if not solved in a timely manner. I had to do a similar project so I created a sc…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question