Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Error trying to Run Perl script on IIS Server 8.5

by masood91 (Novice)
on Oct 29, 2014 at 11:53 UTC ( [id://1105445]=perlquestion: print w/replies, xml ) Need Help??

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

Hello there, I am using windows 8.1 with IIS 8.5. I am trying to run perl script via IIS, but it is giving the following error

The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Can't open perl script "“C:\inetpub\wwwroot\test.pl”": Invalid argument ".

Here is the file i am trying to run:

#!/usr/bin/perl #cgihello.plx use strict; use warnings; print "Content-type: text/plain\n\n"; print "Hello CGI World!\n";

Replies are listed 'Best First'.
Re: Error trying to Run Perl script on IIS Server 8.5
by Discipulus (Canon) on Oct 29, 2014 at 12:37 UTC
    What can i say based on my experience? CGI and IIS is a pure hell!

    Better, if have to run under win32, to install Apache for windows: you will face only 'normal' problems.

    i still maintain an old CGI portal of mines on win2k3 IIS 6.0 because i found no way to make it run correctly under IIS 7.

    I also remember i used -nph #Non Parsed Headers to kick the app running: see CGI docs. I have to admit i never understand well such matter (i think is something due to the internals of IIS).

    Also the error you mentioned is something very frequent in CGI on IIS: if something goes wrong you got this.

    HtH
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      Looks Like you were absolutely right, run the program on wamp, works perfectly fine!!!
      *edit* Hi Disciplus, can you reccomend a book or something for CGI programming on IIS ?
        perlron:Things must have gotten easier now with IIS and CGI im thinking , after all these years. ?
        ahha hahhaha... sorry i could not resist..

        Beside my personl belief (ie Things are getting Worst..) we I can suspect that microsoft does not love so much Perl applications despite many efforts of the Perl community. we have strawberry Perl.

        That said it must be a way to make CGIs running on IIS 8.5.. But as i experienced you run on your own.

        L*
        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

        Looks like you removed your post and repalced it with another, specifically you've changed the text posted in a node. Please don't do this, as you can see it renders responses to be out of context. See 'a few added points' in How do I post a question effectively?.

Re: Error trying to Run Perl script on IIS Server 8.5
by marto (Cardinal) on Oct 29, 2014 at 12:16 UTC

    Likely your IIS config is not complete, but you don't say what you've got setup already. Have you ensured that your handler for perl is setup correctly?

      this is the link i have followed, if this is what you are reffering to: http://www.howtogeek.com/50479/how-to-install-perl-on-iis-7-for-windows-server-2008/

        I've no idea if you've completed this successfully, also you state you're running IIS 8.5, this guide is for IIS 7, if there are differences in the configuration you're not going to find them here. Have you looked at the actual IIS 8.5 documentation?

Re: Error trying to Run Perl script on IIS Server 8.5
by poj (Abbot) on Oct 29, 2014 at 13:31 UTC
    The executable line in the Script Map should have double quotes " around the first %s not 2 single quotes ''.
    C:\Perl64\bin\perl.exe "%s" %s
    poj
Re: Error trying to Run Perl script on IIS Server 8.5
by Anonymous Monk on Oct 30, 2014 at 00:04 UTC
Re: Error trying to Run Perl script on IIS Server 8.5
by Anonymous Monk on Oct 02, 2015 at 10:16 UTC
    Hi, You have to specify : C:\Perl\bin\perl.exe %s %s in the script mapping of IIS 8.5. So no double quotes anymore around the first s, otherwise you get "Invalid argument". In older versions of IIS the double quotes were needed. Best Regards,
Re: Error trying to Run Perl script on IIS Server 8.5
by perlron (Pilgrim) on Oct 29, 2014 at 12:01 UTC

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

    The temporal difficulty with perl is u need to know C well to know its awesome.else u just keep *using* it and writing inefficient code

      This has nothing to do with the issue. They are outputting plain text, not HTML.

      Still the same error!!!!......!!! I have already tried this, here is the complete code which i tried
      print "Content-type: text/html\n\n"; print "<html><head><title>Environment Dumper </title></head><body>"; print "<center><table border=1>"; foreach (sort keys %ENV) { print "<tr><td>$_</td><td>$ENV{$_}</td></tr>" } print "</table></center></body></html>";

        I assume this is your first CGI program.
        1.Try to isolate the problem you are facing by removing the other html tags.
        print "Content-type: text/html\n\n"; print "Hello World!\n";
        2. Run the program from the command line and see if it works.
        3. One common error is forgetting to make the file executable.
        4. If you have a log file on your IIS you might find more info there.
        5. Since you are returning the Content type as text/html , the headers will be properly constructed and sent back to the client by the webserver, provided, your exec Cgi environment is setup correctly. This means you dont have to write <html> </html>like tags for this.
        6. If you suspect a problem with your IIS server setup place an ordinary HTML file in the root directory and see if it is accessible from the browser.
        7. Also the first line of your OP code shows the path as #!/usr/bin/perl. I think would not readily compute under the windows IIS environment ?

        The temporal difficulty with perl is u need to know C well to know its awesome.else u just keep *using* it and writing inefficient code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-19 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found