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

Hi,
I m using IIS, I Created CGI script and enabled web sharing (Application Permission - Execute (include scripts)).
I opened inetmgr and right click on the script and choosen browse. IE get opened with URL (http://localhost/script.cgi). But 500 Internal server error gets thrown.
I changed the file extention as .pl and opened the url http://localhost/script.pl - This time no error but the script gets download (not executed).

Regards,
Anbarasu
  • Comment on 500 internal Server Error on executing CGI script

Replies are listed 'Best First'.
Re: 500 internal Server Error on executing CGI script
by marto (Cardinal) on Jun 22, 2009 at 13:49 UTC

    In addition to the advice you've already been given:

    "But 500 Internal server error gets thrown."

    What does the IIS error log say?

    "This time no error but the script gets download (not executed)."

    Sounds like you have not configured IIS to run files with a .pl extension server side. Consult the IIS documentation for more information.

    Martin

Re: 500 internal Server Error on executing CGI script
by Anonymous Monk on Jun 22, 2009 at 13:40 UTC
Re: 500 internal Server Error on executing CGI script
by dpetrov (Acolyte) on Jun 22, 2009 at 14:45 UTC

    To make your .pl file executable, you should edit your http server.

    In apache it looks something like that:

    AddHandler cgi-script .pl

    What your error log says?

    Did you print the correct headers at the top of your file? (print "Content-type: text/html\n\n";)?

    Do you use strict;?