Solved

CGI Error: explanation needed..

Posted on 2002-07-07
21
193 Views
Last Modified: 2013-12-25
hi all,

i don't really do CGI programming and im not doing it now.  im just wondering about a CGI error coming from a program i installed into an IIS server.
the error is shown below.

thanks in advance,
e.

<error begin>
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
<error end>
0
Comment
Question by:3Mann
  • 6
  • 5
  • 4
  • +2
21 Comments
 
LVL 1

Author Comment

by:3Mann
Comment Utility
more info:

the IIS server runs in Win NT Server 4.0
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
your CGI did not produce a header like:

Content-Type: text/html\n\n
0
 
LVL 5

Expert Comment

by:Peewee
Comment Utility
3Mann,

yes ahoffmann is likely to be correct here look at the presence of a content line.

Content-Type: text/html\n\n

Fialing this make sure you have the correct permissions and the path to perl is correct.

or the path to perl is correct, ie check /usr/bin/perl or whatever you have actually points to perl.


If all these fail, make sure a basic cgi perl works on your server: ie

#!/usr/bin/perl

print "Content-Type: text/html\n\n";
print "Hello World";


let me know how you get on..
regards
Peewee
0
 
LVL 11

Expert Comment

by:mouatts
Comment Utility
I think it is more likely that execution of the CGI failed completely.

Had it output anything then I would expect it to appear within the error message even if it wasn't a valid header.

Moreover I don't thnik IIS actual checks the HTTP header message passed by a CGI. But what it does detect is that the CGI has 'ended' without outputting anything.

0
 
LVL 5

Expert Comment

by:Peewee
Comment Utility
3Mann,
did you get the answer u were looking for?

regards Peewee
0
 
LVL 1

Author Comment

by:3Mann
Comment Utility
hi guys,
isn't it a problem with the IIS settings?

i tried it before and it was running, though now, the program i installed would output that error.
i couldn't do anything though regarding CGI/perl since its a third-party program and can't do any CGI recoding for that.

i tried ticking the checkbox for allowing execution of scripts but still the error is the same.
0
 
LVL 5

Expert Comment

by:Peewee
Comment Utility
3Mann,

assuming your IIS setting are correct then the problem will be either:

A:
===============================
your path to perl is incorrect:

#!/usr/bin/perl

print "Content-Type: text/html\n\n";
print "Hello World";

in the example here perl is expected to be at /usr/bin/perl on a unix system or C:\usr\bin\perl.exe on a windows system.

Solution:
for unix simple do a perl -v for windows check where the perl.exe is located.

B:
incompatable Line endings:
Windows and Unix have different line endings, make sure that if you ftp your program anywhere you have the correct settings, for line endings and ASCII for scripts or binary for images. This problem may occur if you have developed
 on one machine and are planning to run your scripts on another.

Here's what to do:
execute this script below and ensure permissions are 775 the line endings are correct for the operating stystem and
perl is located where the cgi script is teliing the server.


let me know how you get on..
reagrds Peewee
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
ftp ASCII mode is not reliable, make shure the file is in correct format on the sender, then ftp it using bin mode.
0
 
LVL 11

Expert Comment

by:mouatts
Comment Utility
>ftp ASCII mode is not reliable

Absolute nonsense.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
mouatts, try following in a file:

   print "enclosed in ' is a real newline 'NL' character";

(NL means: 0x0a)
then transfer (probably from a Windoze ftp client) the file in ASCII mode, and rethink your statement
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 11

Expert Comment

by:mouatts
Comment Utility
I presume you mean to a windows machine. But yes it will convert to CRLF. But that is perfectly correct because you have effectively created the file as a 'binary file'. Within your example this would be correct because 0x0A is NOT a real newline character it is the Linefeed character (considering LF to be a newline character is very much a unixism) . By converting it the result would actually be correct on each machine - 0A on Unix and 0D0A on Windows etc.

Transfer your example to a windows machine via binary and it won't work, but this doesn't mean that the binary mode is unreliable just that you have used the wrong format!

Making the decision to use either Binary or ASCII mode does require you to know the format of the file that you are going to transfer. Most languages support character constants and programmers should use them to avoid the potential problems caused by using the numeric equivelents. Having said that it is a great shame that Perl/C etc don't support \l for a linefeed forcing you to use \0x0a.

Steve



0
 
LVL 1

Author Comment

by:3Mann
Comment Utility
i appreciate all the answers guys but i was merely installing a software =D

i read the SW requirements of the product and its reqs are only NTServer and IIS.  No mention of perl.exe or any other.  Am i missing something?

Sorry for my naiveity... =D

cheers,
3Mann
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
3Mann, sorry for being off-topic.

> read the SW requirements of the product and its reqs are only NTServer and IIS.
And in which language/type are your CGIs? Could you please check in your cgi-bin directory.
0
 
LVL 11

Expert Comment

by:mouatts
Comment Utility
If the cgi is an exe make sure that the user under which IIS runs has execute permissions on the program and that within IIS execute permission is turned on for the directory in which the cgi is stored.

Steve
0
 
LVL 5

Expert Comment

by:Peewee
Comment Utility
3Mann,

in my first post i wrote:

#!/usr/bin/perl

print "Content-Type: text/html\n\n";
print "Hello World";


make this into a program and run in and see what happens, this will tewst if your server is ok with CGI.

You would be well advised to rule this out first of all.  You of course will need perl.exe installed on your machine, and for this script it is expected at c:\usr\bin\perl.exe

If it is anywhere else this script will not work.


try this and report back exatly what you see. Thius may sound silly be this will save you you an awful lot of time an effort.

regards Peewee
0
 
LVL 5

Expert Comment

by:Peewee
Comment Utility
3Mann,

did u get the answer u were looking for?

regards Peewee
0
 
LVL 5

Expert Comment

by:Peewee
Comment Utility
3Mann,

did u get the answer u were looking for?

if so, would you care to share your solution with us?

regards Peewee
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
hmm, that's exactly what I said in http:#7137280
0
 
LVL 1

Author Comment

by:3Mann
Comment Utility
Sorry guys.  Was just able to come back to this question just now.

regarding the question of peewee:
>did u get the answer u were looking for?
>if so, would you care to share your solution with us?

i actually had this problem when using the client-server antivirus software.
there was no solution as we just used another software.

now how do i give points to this?
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed, with points refunded (30)

modulo
Community Support Moderator
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
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.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now