Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

CGI ERROR Message

Posted on 2007-08-09
8
Medium Priority
?
288 Views
Last Modified: 2013-12-25
DESCRIPTION: I have ActivePerl installed on a MS Server 2003 machine. I have created a cgi-bin and have some scripts in it. when I run the following test script I get an error:
http://www.csscsystems.com/cgi-bin/env.pl 

QUESTION: How do I correct this error message?
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
0
Comment
Question by:cssc1
  • 5
  • 3
8 Comments
 
LVL 18

Accepted Solution

by:
Morcalavin earned 2000 total points
ID: 19661317
Are you printing the header?  Try this script:

#!c:/path/to/perl.exe

print "Content-type: text/html\n\n";

print "Hello, world!";
0
 
LVL 18

Assisted Solution

by:Morcalavin
Morcalavin earned 2000 total points
ID: 19661335
Also, make sure your script has execute permissions and the the perl executable itself has execute permissions.
0
 

Author Comment

by:cssc1
ID: 19661395
Question: How is this done?
Also, make sure your script has execute permissions and the the perl executable itself has execute permissions.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 18

Assisted Solution

by:Morcalavin
Morcalavin earned 2000 total points
ID: 19661418
I'm assuming you have access to log into the server.  Use windows explorer and navigate to the perl script/perl executable.  Right click on it. Go to properties, then click on the security tab.  Find the user that your web server is run under(usually something like IIS_USER or something similar), and make sure they have "Read and Execute" permissions checked.
0
 

Author Comment

by:cssc1
ID: 19661490
HERE IS WHAT I DID:
Setting up Perl/CGI to work with Windows Server 2003

The following things are assumed:

You are running Windows Server 2003
IIS 6.0
You installed ActiveState ActivePerl (http://www.activestate.com) to C:\Perl UPDATE: ActivePerl 5.8.2 Build 808 and higher should add the Web Service Extensions during install
You are using default (unmodified) ACLs/Permissions
Also, all of my reasoning is explained after the step-by-step is done, at the bottom of the page.

Load IIS from the Administrative tools in the Control Panel by clicking Start -> Administrative Tools -> IIS Manager (or loading the Control Panel, entering the Administrative Tools folder, and double clicking IIS Manager).

 

Click the name of your computer then click "Web Service Extensions", on the left side of the main frame you will see a green arrow pointing to a link that says "Add a new Web service extension...", click that link.



In that window, where it asks for the extension name you can put anything, like "CGI script" and under the "Required Files" section put the following in (without the apostrophes) 'C:\Perl\bin\perl.exe "%s" %s' click OK to the notification, click "Set status to allowed" and press ok.



Now, load up a command prompt (Start->Run... type cmd) and type (without the quotes) "md c:\inetpub\cgi-bin"



Back in the IIS Manager right click Default Web Site highlight "New" in the pop-up menu and click "Virtual Directory..." in the new menu



Click next to the first dialog in the wizard, then as a the alias put "cgi-bin" and click next then as a path for the next dialog put in "c:\inetpub\cgi-bin".  On the next dialog leave everything checked and check execute and click next



Click Finish to end the wizard.

Now right-click cgi-bin and click properties



Click Configuration in the lower right-hand area of the dialog and make sure .pl is there (if it isn't, add it the way you see it)



Making your scripts work

To make your scripts work the shebang line (#!/usr/bin/perl) should now be #!C:\Perl\bin\perl.exe .  Any reference to any files should be changed from /home/user etc, to c:/home/user or c:\\home\\users - note the double back-slashes.

Also, renaming your .cgi scripts to .pl is highly recommended - it's what I do myself ;-)

Assuming this is all done correctly, you should now be able to run your Perl scripts successfully using Windows Server 2003, and IIS 6.0

0
 
LVL 18

Assisted Solution

by:Morcalavin
Morcalavin earned 2000 total points
ID: 19661505
Have you tried the script above that I gave you?  Are you still getting an error message after setting execute permissions on the executable and script?
0
 

Author Comment

by:cssc1
ID: 19661526
I don't know how to try the script you gave me. Please give me a cut and past script I can paste into my address bar.
0
 
LVL 18

Assisted Solution

by:Morcalavin
Morcalavin earned 2000 total points
ID: 19661544
That won't do you any good.  You need to test it on your server.  copy this:
#!c:/path/to/perl.exe

print "Content-type: text/html\n\n";

print "Hello, world!";


Now log into your server and save it as test.pl.  Make sure the test.pl script has execute permissions.  Save it in your cgi-bin.  now you should be able to go to http://www.csscsystems.com/cgi-bin/test.pl and see if the script works.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …
Suggested Courses

580 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