Windows knows the script is a Perl script by the ending on the file name. Worse yet, for the Microsoft IIS Web server, having Windows know the extension is not sufficient; it must be specifically known within each IIS Web site application mapping. In contrast Unix/Linux looks for the "#!/usr/bin/perl\n\n" instruction on the first line to know what program to run. IIS ignores this line.
The ActiveState default is to add the ".pl" extension to the IIS list of recognized Web applications. In your case you could test this by changing your file name from testscript.cgi to testscript.pl and see if it now runs in the browser.
To manually add the .cgi extension to automatically execute Perl for your web site in IIS 5.0, follow the Programs/Administrative Tools/Internet Services Manager path. In the Internet Services Manager find the web site and get to its properties sheet from the menu popped up by a right click on the web site name.
When you have the Properties sheet up, click on the "Home Directory" tab at the top. On that page look for the Configuration button below and to the left of the application field.
Under the "App Mappings" tab Look down the list of extensions known to that IIS web server and see if the .pl extension is listed. If so, you can check out its properties (path, verb set, etc.) and use it as a model for a new application extension, except this time with the .cgi extension.
On the executable path add "%s" %s for parameters. In my case the executable path is set to:
D:\Perl\bin\Perl.exe "%s" %s
which happens to be the location of Perl.exe on my system.
Set the extension to .cgi, the Verbs set to "Limit to" with POST,GET,HEAD
typed in, and the "Check that file exists" option is on with the "Use script engine" option off.
With this change, IIS now knows what application to use to execute testscript.cgi
ONE LAST CONSIDERATION: the security setting or Access Control List (ACL) for the directory holding the script and script must include a user that IIS can runs as -- normally IUSR_your-computer-name with at least read privileges. If you are not running the script in the normal INET path, this too can cause problems -- returning the message that you don't have permission to access the page.
Hope this does it.
Speedy
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.