Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked


by wxhead (Initiate)
on Jun 18, 2012 at 15:33 UTC ( #976847=perlquestion: print w/replies, xml ) Need Help??
wxhead has asked for the wisdom of the Perl Monks concerning the following question:

I have strawberry perl installed on a windows 2003 server running IIS 6

I am tying to run a cgi script but it seems like it is trying to be downloaded to my browser. Note this script creates a web page with html.

when i try to run the script from IE I get

Internet explorer can not download from <servername> Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please tr +y again later.

This is a very simple script.

Here it is.

#!c:\strawberry\perl\bin\perl.exe use strict; use CGI; my $test = new CGI; print $test->header("text/html"),$test->start_html("Perl Test"); print $test->h1("Perl is working!"); print $test->end_html;

Can someone give me a hint?


Replies are listed 'Best First'.
by davido (Archbishop) on Jun 18, 2012 at 15:46 UTC

    There is nothing wrong with your script, so it's really not so much a Perl issue as it is a configuration issue.

    Is your server configured to recognize this script as an executable script rather than as static content? Is this script readable and executable by the web server (permissions)? Those are a couple of obvious places to start.

    And keep in mind that the server maintains a log of error messages that the browser never sees. Find that log and read what's in it. The messages will be enlightening.


by thomas895 (Chaplain) on Jun 18, 2012 at 15:47 UTC
by ww (Archbishop) on Jun 18, 2012 at 15:54 UTC
    First hint: use <c>...</c> around code (update : which was not the case as initially posted. </update>)

    Second, et seq: There's nothing in the script you showed to explain this commonplace problem. So, (granting that some/all may be irrelevant under IIS) is the script executable under IIS6; is it in the right place (/me suspects the hashbang gives a path that's incorrect from the server's perspective); does the server have permissions to execute anywhere in c:\strawberry\perl\bin\ and, specifically, in whatever dir your script is stored? Is the server actually running ("The requested site is either unavailable or cannot be found.") and last, but definitely not least, what gives you the impression "it seems like it is trying to be downloaded to my browser...?"

by zentara (Archbishop) on Jun 18, 2012 at 18:22 UTC
    Another common mistake is to put your cgi script in the html root directory, instead of the cgi-bin directory. Most servers are set up to serve out anything in html root by just delivering the page or file. It will only be executable in your cgi-bin directory, or any directory setup in the server configuration file to execute cgi scripts.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
by Anonymous Monk on Oct 08, 2012 at 21:19 UTC
    Sorry but I was pulled off this. Now looking at this again. I am now getting CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://976847]
Approved by ww
[Eily]: that's one long sheband

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2018-05-25 08:14 GMT
Find Nodes?
    Voting Booth?