Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get my CGI script to work under IIS:

IIS Script Configuration

How do I get my CGI script to work under IIS:

by  missbarbell  Posted    (Edited  )
The following is by no means complete, but will hopefully help you figure out where you might be going wrong.

In the Internet Services Manager (under the Administrative Tools of your Control Panel), right click either on the Default Web Site or your Virtual Directory and select 'Properties'. This should then popup a box of configuration settings. Select the 'Home Directory' tab. Towards the bottom is a drop-down list of 'Execute Permissions', at the very least this should be set to 'Scripts only'. Next to this drop-down list is a 'Configuration' button, click it. This will open an Applications Configuration popup, with a list of 'App Mappings'.

These 'App Mappings' tell IIS which extensions map to which applications. For example the .asp extension should map to a asp.dll. In order to get you CGI scripts to run in IIS, you will need to map the extension of your script to the correct application. In this example I will assume that .cgi and .pl are Perl scripts, but the principle applies to any other CGI scripting language & extension.

On the 'App Mappings' tab, click the button that says 'Add'. This will bring up a blank input popup. The format for the 'Executable:' text box is "<path to app> %s", which for ActivePerl would usually be "C:\Perl\bin\perl.exe %s". The '%s' indicates that the script file needs to be added to the command string. This last bit is probably the most important bit, as I recently spent half a day trying to figure out why scripts wouldn't work only to discover this little gem.

Next add your extension. If you need both .cgi and .pl, you will need to add them separately from the Configuration popup. For this example we'll just add '.pl' into the 'Extension:' text box. The other inputs can be left as is, although it is worth checking the box for 'Check that file exists', just in case something gets deleted or moved. Finally click 'Ok'. On returning to the Applications Configuration popup, you should see a newly added entry to the list. Now either click 'Apply' or 'Ok' to apply the changes.

You will need to stop and start the Web Server in order to action these changes, but once reactivated you should be able to run your CGI scripts :)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top