Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

CGI SCRIPT

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 test.pl 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?

Help!

Comment on CGI SCRIPT
Select or Download Code
Re: CGI SCRIPT
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.


    Dave

Re: CGI SCRIPT
by thomas895 (Hermit) on Jun 18, 2012 at 15:47 UTC
Re: CGI SCRIPT
by ww (Bishop) 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...?"

Re: CGI SCRIPT
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
Re: CGI SCRIPT
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.
Reaped: Re: CGI SCRIPT
by NodeReaper (Curate) on Oct 23, 2013 at 06:01 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://976847]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-08-01 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls