Help - Search - Members - Calendar
Full Version: Setting up Perl/CGI to work with Windows Server 2003
The Planet Forums > Operating Systems > Microsoft Windows > Windows HOWTOs
rubaljain
Setting up Perl/CGI to work with Windows Server 2003

1) Install ActiveState ActivePerl (http://www.activestate.com) to C:Perl

2) Load IIS from the Administrative tools in the Control Panel by clicking Start -> Administrative Tools -> IIS Manager (or loading the Control Panel, entering the Administrative Tools folder, and double clicking IIS Manager).

3) Click the name of your computer then click "Web Service Extensions", on the left side of the main frame you will see a green arrow pointing to a link that says "Add a new Web service extension...", click that link.

4) In that window, where it asks for the extension name you can put anything, like "CGI script" and under the "Required Files" section put the following in (without the apostrophes) 'C:Perlbinperl.exe "%s" %s' click OK to the notification, click "Set status to allowed" and press ok.

5) Now, load up a command prompt (Start->Run... type cmd) and type (without the quotes) "md c:inetpubcgi-bin"

6) Back in the IIS Manager right click Default Web Site highlight "New" in the pop-up menu and click "Virtual Directory..." in the new menu

7) Click next to the first dialog in the wizard, then as a the alias put "cgi-bin" and click next then as a path for the next dialog put in "c:inetpubcgi-bin". On the next dialog leave everything checked and check execute and click next

icon_cool.gif Click Finish to end the wizard.
tmat
Hi
One of my user have FormMail on her web page, and she can't get it to work. I copied FormMail.pl, FormMail.php and FormMail.cig to c:inetpubcig-bin and also made a directory within her home diriectory saying cgi-big and copied the above 3 files in there also. Will you be able to shed a light on why FormMail isn't working? I am guessing that FormMail only works for linux becaue it's config file has line saying "/usr/blehbleh" which sounds like linux program.

Thanks!

:confused: :eek:
LighthousePoint
Formmail is a HUGE security risk -- you are better off using the PHP mail() function.
tmat
Thanks, I'll have a look at mail() function, and ask her if I could re-write her code. Basically what she's doing is have couple of text box and when user click on "submit" button, it send an email to her.
LighthousePoint
yep, the PHP mail() function is much better suited for that.
tmat
allright, we are both organizer of this non-profilt organizaioton and we just found out that she knows nothing of php and ask me to re-write her page, which I can't do. Is there any way to get formmail to work with this tutiorial because right now, it won't.

Thanks to the original poster and Lighthouse for help. You guys rocks.
Carly
I followed the instructions above perfectly but I keep getting "page not found" when trying to hit a .cgi file from the web. It's like it's not there, but it is.

[UPDATED] I figured out the problem, so I'm posting what I did for others who are also still learning. Basically my site was not recognizing the .cgi extension.

1) In IIS go to your Default Website

2) Select properties

3) In the Home Directory tab, choose configuration

4) In App Mappings you will most likely not see an entry for *.cgi

5) Review the settings in App Mappings for the .pl extension

6) Copy the settings from the .pl extension and Add a new

7) Application Mapping for .cgi and then Apply
tmat
i went to property tab of the web site i was talking about. i saw no mapping of cgi, nor pl. eventhough i installed cgi and perl following the posted instruction.

i want to ask, how i can map the extention in 'configure' tab you were taling about? and most importantly, this how to need to be RE done
LighthousePoint
add the new extension of .cgi and .pl files.
tmat
aight, i missed the excellent answer from carly. i m sorry. i tried to add *.cgi, but when i try to cut and past C:Perlbinperl.exe "%s" %s iis says the file is already in used by other extention and says i can't add that. so i m not sure what to do. i tried to re-configure php but even php port of formmail is no workie. i think the gir who run the site got so turned off by my luck of ability to fix things.

oh well. i've just told her that my site (different chapter of the same organization) does just fine by putting email link and it's not worth spending our time tyring to figure out formmail thingy, and spend more of our energy trying to set up more shows on oct.11th.

but i really appriciate you guys tyring to help me out,

happy birthday to me,
signed.
tmat.
4web-space
Anyone using this in ISAPI mode?

Robbie
LighthousePoint
I tried it, but as ActiveState (and others) have pointed out, it's not stable yet... I'd recommend fast-cgi for the moment,
4web-space
With Perl in CGI mode it constantly throws the following errors

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

With Perl in ISAPI mode the basics are extremely stable however it doesnt seem to be able to locate additional modules that are installed?

Any ideas on either problem?

Robbie
yong
I face the same problem too...

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Any one know what is the problem?
gooberdlx
i have had the same error on all of my perl scripts..

:: shrugs ::

Jake
BlueMonkey
I had the same problem but when i gave the folder "write" rights it worked fine.
yong
Which folder did you give the 'write' access exactly? I tried all ways but still my script couldn't work....
aussie
QUOTE
Originally posted by rubaljain
[B]Setting up Perl/CGI to work with Windows Server 2003  

1) Install ActiveState ActivePerl (http://www.activestate.com) to C:Perl

2) Load IIS from the Administrative tools in the Control Panel by clicking Start -> Administrative Tools -> IIS Manager (or loading the Control Panel, entering the Administrative Tools folder, and double clicking IIS Manager).

3) Click the name of your computer then click "Web Service Extensions", on the left side of the main frame you will see a green arrow pointing to a link that says "Add a new Web service extension...", click that link.

4) In that window, where it asks for the extension name you can put anything, like "CGI script" and under the "Required Files" section put the following in (without the apostrophes) 'C:Perlbinperl.exe "%s" %s' click OK to the notification, click "Set status to allowed" and press ok.

5) Now, load up a command prompt (Start->Run... type cmd) and type (without the quotes) "md c:inetpubcgi-bin"

6) Back in the IIS Manager right click Default Web Site highlight "New" in the pop-up menu and click "Virtual Directory..." in the new menu

7) Click next to the first dialog in the wizard, then as a the alias put "cgi-bin" and click next then as a path for the next dialog put in "c:inetpubcgi-bin".  On the next dialog leave everything checked and check execute and click next

icon_cool.gif Click Finish to end the wizard. [/B]


What about .cgi and .plx mappings?

Im looking at the perl mapping for some of my sites and i see

.cgi 'C:Perlbinperl.exe "%s" %s'
.pl 'C:Perlbinperl.exe "%s" %s'
.plx 'C:Perlbinperl.exe "%s" %s'

I think .cgi and .plx are wrong! Shouldnt it be 'C:Perlbinperl.exe '
aussie
Anyone?
rubaljain
QUOTE
What about .cgi and .plx mappings?

Im looking at the perl mapping for some of my sites and i see

.cgi 'C:Perlbinperl.exe "%s" %s'  
.pl 'C:Perlbinperl.exe "%s" %s'  
.plx 'C:Perlbinperl.exe "%s" %s'  

I think .cgi and .plx are wrong! Shouldnt it be 'C:Perlbinperl.exe '


I use following on my machines it work fine for me.

.cgi 'C:Perlbinperl.exe "%s" %s'
.pl 'C:Perlbinperl.exe "%s" %s'
.plx 'C:Perlbinperl.exe "%s" %s'
aussie
The the above is correct for cgi, pl and plx? Can somebody verify this because on my IIS5 box cgi and plx are mapped to C:Perlbinperl.exe with only .pl mapped to .pl 'C:Perlbinperl.exe "%s" %s' so i was wondering why on IIS6 everthing is mapped to .pl 'C:Perlbinperl.exe "%s" %s' ?
rubaljain
Hello -

I saw it on my Windows 2003 boxes they are also mapped as :

.cgi 'C:Perlbinperl.exe "%s" %s'
.pl 'C:Perlbinperl.exe "%s" %s'
.plx 'C:Perlbinperl.exe "%s" %s'

Also tried running test sample pl and cgi files .. i didn't found any issue.

Regards
blueskyhost
Windoze perl is extremely fussy about permissions - they need to be 755 for the cgi-bin directory and 755 for the scripts. That's read-write-execute for the illiterates. Have a look at the link in my How-To thread in the Helm forum - there's a link or two there that might be helpful.

Most of these problems can be sorted out with a bit of messing around. I always start by giving "Everyone" permissions which are "Full Control" - that way you can exclude permissions as an issue. If it works under those settings, you can work backwards to a more secure setup. Good luck everyone.
MX-3.com
I am just setting up my new Windows Server 2003 Web Edition, and am going to have a bunch of questions.

First is which version of ActiveState Perl should I be downloading?

They have 2 version listed on the site and I am not sure which is better? which one is more stable?

http://www.activestate.com/Products/Downlo...x?id=ActivePerl

Thanks in advance,
Intrepid00
I used the most recent one and it added the paths and extentision for me. I just had to go and and allow it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.