holidayIT has asked for the wisdom of the Perl Monks concerning the following question:

I have perl on iis 6 on a win2k3 server. my scripts run fine in the command line, but not in IE. I get the CGI Error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. my first line of code after the shebang line is: print "Content-type: text/html\n\n"; but that doesn't seem to be the problem. Does anyone have any ideas???? ( my guess is my iis setup, i followed instructions from visualwin.com/perl) I will give you my first born if you can help me.

Replies are listed 'Best First'.
Re: CGI Error HTTP headers of doom
by dash2 (Hermit) on May 26, 2004 at 19:25 UTC
    There could be lots of things wrong. It sounds like your script is fine, but just in case it isn't (maybe some use statements are failing - they get executed before the rest of your code, as if they were wrapped in a BEGIN{} block) you could try making this your first statement:

    use CGI::Carp qw(fatalsToBrowser);

    This will catch any runtime errors and redirect them so the browser can see them.

    However, more likely it is a configuration error. Check with a very simple test script to see if it works, e.g.

    print "Content-type: text/html\n\n"; print "<html><body>OK</body></html>";

    if that fails, it is an IIS config problem.

    A massive flamewar beneath your chosen depth has not been shown here
Re: CGI Error HTTP headers of doom
by davido (Cardinal) on May 26, 2004 at 15:44 UTC
    An error occurred prior to the execution of the line that prints your headers. The server's web error log will reflect what error that is.

    Possibilities include the server not having permission to execute the script, the script residing in a directory that isn't set up for CGI, the script has a dependancy on a library or module you created that hasn't been set up with proper permissions, or any of a number of other possibilities.

    Another possibility is improper line endings (something that is OS dependant).

    Basically I can only provide speculation, and may be way off base. If you don't check the server's error log you'll never be sure. Your webserver docs will tell you where to look for CGI errors. Maybe you don't even have CGI enabled on your server.


    Dave

Re: CGI Error HTTP headers of doom
by EdwardG (Vicar) on May 26, 2004 at 15:45 UTC

    For more information, try turning on "Show friendly HTTP error messages", you can find it on the Advanced tab under Internet Options.

    An even better option would be to use FireFox.

     

      unfortunately, there are no errors in the event log (is that what you mean? i am an uber-newbie). I tried the show friendly http errors as suggested and there was nothing. would it help to see my test code??

        I was referring to your IE browser, to get it to show you more information. But it sounds more like a configuration problem, and I recommend that you try dash2's suggestions. Let us know if this gets you more information that we might be able to help you interpret.

         

Re: CGI Error HTTP headers of doom
by punkish (Priest) on May 26, 2004 at 22:43 UTC
    Given that you have provided very little info to go on, here is a guess. Is your IIS config-ed properly to work with Perl?

    Make sure that in the properties of the website, under Mappings, .cgi or .pl (whatever you are ending your scripts with) is config-ed thusly --

    .cgi path\to\perl.exe %s %s