Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI doesnt work on Apache

Status
Not open for further replies.

Oxymoron

Technical User
Dec 17, 2000
168
GB
Hi.
I have a VERY simple CGI script which doesn't appear to work.
Firstly Windows doesnt recognise the .cgi extension, but i doubt it's that.
All the script does is take a string from an inputbox an should display the string on a webpage.
Is there a mistake in my script? :
--------------------------------------------------
#!/usr/bin/perl -w

if ($ENV{'REQUEST_METHOD'} eq "GET") {
$in = $ENV{'QUERY_STRING'};
} else {
$in = <STDIN>;
}
print << END;

Content-Type: text/html\n\n

<html>
<body>
<center>
<font size = 20> RESULTS
<br>
name = $in
</font>
</center>
</body>
</html>

END
-------------------------------------------------------
I'm using a POST method, but I don't think that's anything to do with it, as I keep getting a 'Internal Server Error' page from Apache.

I really hope someone can help!
Any and all suggestions welcome!
thanks every1; JoE we are all of us living in the gutter.
But some of us are looking at the stars.
 
What does you error log say? It usually contains the errors that caused the internal server error. //Daniel
 
Your shebang looks like a Unix path. Is that really your Windows path to the perl.exe? If not, it won't work until you reference the correct path.

For that matter, did you install Perl for Windows? Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
As Daniel says, your logs will tell you a lot about what is happening. Is it just this script, or don't any scripts work? If Windows doen't like the .cgi extension you may try .pl. If that does the trick you can add it to your mimetypes or add the .pl extension to the AddHandler directive for cgi scripts in your httpd.conf. Is the directory you have the script in set to allow execution of scripts in httpd.conf? Is perl working and in your path? If not, set the shebang to the correct path.
 
I have ActiveState Perl for Windows.
I can't get output for form actions = &quot;*.cgi&quot; or &quot;*.pl&quot; either.
Do I wanna open or save file to computer comes up, and if I
open with &quot;*.pl&quot; it opens the shell of the perl interpreter. I just wanna write a query to an output form.
 
Do you have Apache installed? Are you using it to access the script? It sounds to me as if you just double clicked the file. //Daniel
 
Apache is installed on mine, and the .cgi or .pl output file is in its subfolder cgi-bin. The form action uses a relative address to access it. I still cannot get it to work. Is anyone kind enough to share their know how?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top