Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

New to CGI/Perl, so this is easy (I guess)..

Posted on 2001-08-21
5
Medium Priority
?
164 Views
Last Modified: 2013-12-25
I made the following script:
-----------------------------
#!/bin/perl
my $in;
if ($ENV{'REQUEST_METHOD'} eq "GET")
{     $in=$ENV{'QUERY_STRING'};}
else {      $in=<STDIN>; }

print "TEST";
------------------------------

If I am not too wrong, this should just print "TEST" on any website.

The HTML form looks like this:
------------------------------
<form name="form1" method="post" action="/cgi/test.pl">
  <input type="submit" name="Submit" value="Submit">
</form>
------------------------------

When I click on the button, I get an internal server error? Other cgi's (which my collegues built) works fine on the same server..same directories.

I changed the .pl file to be executable..but it still doesn't work. Please help =)
0
Comment
Question by:thomas77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
bebonham earned 400 total points
ID: 6410653
it could be that you are not pointing to the right perl
make sure the path to perl is correct, usually
#!/usr/bin/perl

but I know you have to change this...

so try the below:

#!/bin/perl

print "Content-type: text/html\n\n";  ##tell the browser to expect html
my $in;
if ($ENV{'REQUEST_METHOD'} eq "GET")
{     $in=$ENV{'QUERY_STRING'};}
else {      $in=<STDIN>; }

print "TEST";
0
 

Author Comment

by:thomas77
ID: 6410686
Great and quick answer!
Thanks mate =)

/Thomas
0
 

Author Comment

by:thomas77
ID: 6410687
It was the Print Content stuff..
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6410703
figured as much..

good luck, enjoy Perl!!

Thanks for the 'A' Grade
0
 

Author Comment

by:thomas77
ID: 6410711
It was the Print Content stuff..
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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 …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

661 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