You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by "T.Liu" <t....@telia.com> on 2002/03/17 00:12:50 UTC
mod_cgi/10223: GGI files fail to load correctly
>Number: 10223
>Category: mod_cgi
>Synopsis: GGI files fail to load correctly
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apache
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: support
>Submitter-Id: apache
>Arrival-Date: Sat Mar 16 15:20:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: t.liu@telia.com
>Release: 1.3.2.3
>Organization:
apache
>Environment:
Windows 2000, Visual C++ 6.0
>Description:
I have written a simplest CGI with C++ on Windows 2000 as folllows
#include <iostream>
using std::cout; using std::endl;
void main ()
{
cout << "Content-type:text/html" << endl << endl;
cout << "<html><body>" << endl;
cout << "Hello, dear friends" << endl;
cout << "</body></html>" << endl;
}
The excutable is renamed to hello.cgi and placed in "F:\Program Files\Apache Group\Apache\cgi-bin", and loaded from the following html file when clicking the "here" field
<html><body>
Click <a href="hello.cgi">here</a> to call a cgi program directly
</body></html>
As response, the browser (Internet Explorere 5.0) says "The page you are looking for is currently unavailable". Looking at error.log file, it states that Apacher webserver cannot find the file on "F:\Program Files\Apache Group\Apache\htdocs" directory. After copying hello.cgi into this directory, the browser does find it. But instead of dislaying the HTML contents generated from the CGI, it popups a dialog box and tries to download the CGI file with the text "Your have chosen to download the file Path..//hello.cgi". My questions are
1. Why Apache webserver looks at "htdocs" directory, although the http.cfg file
indicated that is SHOULD be "cgi_bin" by the follwing line?
ScriptAlias /cgi-bin/ "F:/Program Files/Apache Group/Apache/cgi-bin/
2. Why Apache tries to download the CGI file instead of loading the scripts it
generates?
Do I need to change anything more on httpd.cfg file other than ScriptAlias /cgi-bin/ to make Apache load the CGI files correctly? Consultaing Apaches online Bug Database, I replaced cgui loading default config (marked off with #) with what is taken from PR number 7127, as follows
<Directory "F:/Program Files/Apache Group/Apache/cgi-bin">
#AllowOverride None
#Options ExecCGI
#Order allow,deny
#Allow from all
AddHandler cgi-script cgi pl
AllowOverride Options
Options Indexes FollowSymLinks MultiViews ExecCGI
Order allow,deny
Allow from all
</Directory>
This however doesn't make any difference. Please help me to make cgi running.
>How-To-Repeat:
>Fix:
No, but I would appreaciate it greatly if you could add a item in your FAQ to clearly explain how cgi scripts of C/Perl can be made working on Windows (and Linux as weel) step by step. What configurations have to be changed and checked exactly. The above extremely simple script has toiled me two days, and it may happen to other Apacher users as well.
>Release-Note:
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or ]
["Re: general/1098:"). If the subject doesn't match this ]
[pattern, your message will be misfiled and ignored. The ]
["apbugs" address is not added to the Cc line of messages from ]
[the database automatically because of the potential for mail ]
[loops. If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request from a ]
[developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]