Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Can CGI be used in IIS and how can I enable IIS to use CGI script

Can CGI be used in IIS and how can I enable IIS to use CGI script. I am running Windows NT Server 4.0. My CGI script just do not work on my webpage.
I also used VBscript and Frontpage and ASP for my web page. I created it in PWS it worked fine but after I transfer it to IIS it just do not work
0
da511
Asked:
da511
  • 14
  • 11
  • 2
  • +1
1 Solution
 
maneshrCommented:
sure you can use CGI with IIS. if you are using/plan to use PERL for CGI scripting, here how you configure and test a PERL Script with
Internet Information Server (IIS)

============================================
Configuring and Testing a PERL Script with Internet Information Server (IIS)

SUMMARY

  The following PERL script can be used to test for the proper installation and execution of CGI scripts with Internet Information server.

MORE INFORMATION

  Create a file with Notepad, and type the following lines of code. Save the file in the scripts
  directory as Helloworld.pl.

  print "HTTP/1.0 200 OK\n";
  print "Content-Type: text/html\n\n";

  print "<HTML>\n";
  print "<HEAD>\n";
  print "<TITLE>Hello World</TITLE>\n";
  print "</HEAD>\n";
  print "<BODY>\n";
  print "<H4>Hello World</H4>\n";
  print "<P>\n";
  print "Your IP Address is $ENV{REMOTE_ADDR}.\n";
  print "<P>";
  print "<H5>Have a nice day</H5>\n";
  print "</BODY>\n";
  print "</HTML>\n";


  Once you have created the file, you need to configure PERL to run securely with Internet Information. Perl.exe should not be located in any of the directories accessible by a user with a browser.

  With a script mapping in the registry, you can place the Perl.exe outside of the normal directory structure a user has access to.

  To configure PERL script mapping

     1.Start Regedt32.exe and open the following registry key:

       HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC
\Parameters\ScriptMap

     2.Click Add Value from the Edit menu.

     3.The Value Name is .pl

     4.The Data type is REG_SZ.

     5.The String value is <the full path to perl.exe>\perl.exe %s %s

       NOTE: The "%s %s" is case sensitive. (e.g. "%S %S" will not work).

     6.Restart the WWW service.

  Now that the registry has been configured, you can test the PERL script with your browser.
  Using the defaults directory structure with IIS, the URL would be the following:

       http://<Server Name>/scripts/helloworld.pl?
0
 
da511Author Commented:
Where to find the Pearl.exe. I am not sure about this part
0
 
maneshrCommented:
perl is bundled with IIS. check for perl.exe in the directory where you have installed IIS.(dir /s/w/a/p perl.exe)
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
da511Author Commented:
how come I can't find it. Is it inside the Inetpub directory??
Can anyone pls help pls. I really need it to be done quickly

Thanks

Your Help will be greatly appreciated
0
 
da511Author Commented:
What about the extensiton .pm how can I add it in the registry. Pls send me the Pearl.exe at da511@singnet.com.sg
0
 
da511Author Commented:
Can you tell me where to place the pearl.exe
0
 
maneshrCommented:
"...Is it inside the Inetpub directory"

yes it should be in the Inetpub directory. try this. Lets say your inetpub is in the c drive.

* go to the DOS prompt.
* change to c:\
* at the command prompt, type dir c:\perl.exe /s/w/a/p

if perl.exe exists on your system, you will find the exact location to the file.

Let's say you dont have perl.exe on your system, you can download the same from ....

http://www.cpan.org/ports/index.html#win32

Also checkout for PERL under IIS ...
http://www.geocities.com/SiliconValley/Park/8312/perlis.htm


once you have the downloaded file, unzip it and run set up.

Then follow the steps that i had mentioned earlier.

Hope that helps. :-)
0
 
da511Author Commented:
Is it under the "module"
There are a lot of zip files with different different name. which is it
0
 
maneshrCommented:
you can get Standard Perl (5.004) for Win32 for x86 at
(http://www.cpan.org/ports/win32/Standard/x86/perl5.00402-bindist04-bc.zip)

when you unzip this file, it creates a directory (perl5.00402-bindist04-bc) under which it store all the PERL executables and modules. The perl.exe is in perl5.00402-bindist04-bc\perl\bin directory.

if you want i can email the zip file (1.5MB) to your email address.
0
 
maneshrCommented:
sorry the file size is not 1.5 MB but 5.9 MB. let me know if your still want it and i will email it to da511@singnet.com.sg


0
 
da511Author Commented:
I think I can download it myself. How about the .pm extension. Do I need to do any thing to this
0
 
maneshrCommented:
pm are PERL modules that are used when you start writing perl code.
your first target should be to download & install PERL for Win 32 and configure IIS so that it interprets perl scripts properly.

ONLY after that will you need to use a .pm (PERL Module) file like CGI.pm etc..

Rgds
0
 
da511Author Commented:
I have already found the perl.exe
Can u explain this?? I am still not sure where to place the file. Can u give me an example of where to place the file

"Once you have created the file, you need to configure PERL to run securely with Internet Information. Perl.exe should not be located in any of the directories accessible by a user with a browser."

0
 
maneshrCommented:
can you pl. give me the full path to the perl.exe file??

Eg. C:\xyz\perl.exe

And also give me the full path to the Inetpub directory??
0
 
da511Author Commented:
For the perl.exe, I just copy it from the folder I had unzipped from and place it on the desktop at the moment
For the Inetpub, the path is D:\Inetpub
0
 
maneshrCommented:
you will have to use the entire directory and not just the perl.exe file.

so lets say you have unzipped the downloaded file in c:\perl5.00402-bindist04-bc

then the full path to your PERL executable is ...

c:\perl5.00402-bindist04-bc\perl\bin

with this info now you can use the "Configuring and Testing a PERL Script with Internet Information Server (IIS)" section that i have explained above.

Rgds
0
 
da511Author Commented:
Can you explain this in again

Is this correct
Name         Data
======================
Default      ""
..pl          D:\perl5\perl\bin\perl.exe
             %s %s  

2.Click Add Value from the Edit menu.
3.The Value Name is .pl
4.The Data type is REG_SZ.
5.The String value is <the full path to perl.exe>\perl.exe %s %s
6.Restart the WWW service.

Where to add REG_SZ Do it had a period behind this example "REG_SZ."  

Thanks
David Wong

0
 
makerpCommented:
to install/configure perl in iis do this.. its easy  

if your on winNT then download activeperl. it makes for such an easy life. http://www.activestate.com

to enable a dir to allow execute access:

all you have to do is set the directory that you want to exe in to execute rights from within the microsoft managment consolue or using pws managemnt thingie. DO NOT set that dir to write access as well, if you try mmc will warn you of security probs.
to do this select properties on the dir in question (cgi-bin if you like) and then selet execute on the directory tab. this can be at virtual dir level of a dir underneath this.


setting up perl.exe:

when you install activeperl it sets up the .pl link to the perl exe for you. if your not using activeperl or you installed active perl after iis then you need to go to mmc/default web site/ properties/home directory and then click on the configuration option. a window will appear with all of your exention mappings in. add one for .pl

extension - .pl
executaable - <DRIVE:>\<perl path>\perl.exe %s %s
method exclusions - PUT,DELETE

by doing this at the web site level these settings will stand for all virtual dirs unless you specify other wise.

if its a perl script you want to run then leave the .pl extension, put the script in the dir with exe rights and your off !!

IIS also supports the use of a perliis.dll mapping to a .plx extension. im not sure but i think this is microsofts awnser top mod_perl. dont quote me on this though as ive never had the need to use it...

because iis does the perl thing on the extension you don not need #! perl path at the beging of you script.  if you do it will be ignored ..

to run a standard .exe then the dir permissisions need to be execute

hope this is what you want ?

0
 
maneshrCommented:
."Where to add REG_SZ Do it had a period behind this example "REG_SZ."


REG_SZ is a data of  type string.

the . after REG_SZ is the full stop. you should be able to select the data type when you click of the value option.


"s this correct
                   Name         Data
                   ======================
                   Default      ""
                   ..pl          D:\perl5\perl\bin\perl.exe
                                %s %s   "

should be fine as long as your perl.exe is in the path that you have mentioned above . Also the foll should be on a single line as follows..


D:\perl5\perl\bin\perl.exe  %s %s
0
 
da511Author Commented:
To : maneshr or any other expert

Can I send my webpages to you so that you can tell me what type of cgi is used. What is required to host this site on the IIS because I am not the one who actually created this webpages.
I really want to find the root of the problem

Can you experts pls help. I really need the website to be up immediately.

Pls give me your email address so that I can email the folder to you. It is just a 1.33mb zip file.

My email address is da511@singnet.com.sg


Thanks
0
 
da511Author Commented:
I think I am using cgi written in Visual basic. What are the things I need to set in IIS
0
 
maneshrCommented:
you can email me at maneshr@hotmail.com.
0
 
da511Author Commented:
maneshr, the email that I had sent to you bounce back to me. Is this a valid email address
0
 
maneshrCommented:
yes it is. try sending to
maneshr@yahoo.com with a CC to jitu7125@hotmail.com

0
 
da511Author Commented:
I think it is those exe files unable to use them
0
 
da511Author Commented:
It is those exe files in the cgi-bin that I cannot execute
0
 
ghersonCommented:
To respond to the last two comments, the way I got .exe's executing on the server, instead of offered for download, was to define my local cgi-bin dir as a virtual directory to IISv5.0 (this wasn't nec on my WinXP IISv5.1 machine).  Previous to that I had tried all the items I saw suggested, etc, to no avail so this is good to know.

Defining virtual directories is easy.  On Computer Management - Services - Internet Information Services - Your Web Site, right-click.  Click New - Virtual Directory and your about done.

0
 
makerpCommented:
i should imagine people have forgotten about this Q ;)
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 14
  • 11
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now