Forum Moderators: coopster & phranque

Message Too Old, No Replies

Setting up Perl on Win Sever 2003

And need some help!...

         

Karma

3:13 pm on Apr 23, 2008 (gmt 0)

10+ Year Member



Hi all,

I have a fresh install of Windows Server 2003 and could really use some help getting things working.

The only reason we need Perl on this server is so that existing scripts can use formmail (from Matts script archive). The formail Perl script will be held in the following folder:

C:\Inetpub\wwwroot\mywebsite.com\cgi-bin

To get this working, I have already downloaded Activestate ActivePerl (5.8.2.808-MSWin32-x86.msi) and installed Perl to C:\Perl and that installation went fine.

What further steps do I need to make sure Perl works? Do I have to point it at the cgi-bin folder? Any further advice would be greatly appreciated :)

Thanks

perl_diver

7:03 pm on Apr 23, 2008 (gmt 0)

10+ Year Member



This is really a server question, not a perl question. I suggest you ask on a forum that discusses that server. There might be some perl coders that know the setup required but they are really two totally seperate topics. Or wait and see if someone offers you some advise.

Karma

9:14 am on Apr 24, 2008 (gmt 0)

10+ Year Member



Thanks for the reply. Is there a more appropriate section here at WebmasterWorld to ask?

perl_diver

7:31 am on Apr 25, 2008 (gmt 0)

10+ Year Member



There appears to only be an Apache forum as far as http servers go. So I do not know where if any section of webmasterworld is a very good place to post this question. I am sure there are other forums that can answer the question or use google to search for tutorials about the server you are using.

coopster

5:48 pm on Apr 25, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The Activestate web site has support pages that document installation. Also, there is another HTTP support forum here at WebmasterWorld, one for IIS:

Microsoft IIS Web Server and ASP.NET [webmasterworld.com]

perl_diver

9:58 pm on Apr 25, 2008 (gmt 0)

10+ Year Member



oops, my bad, I missed that forum when looking at the main list.

coopster

4:55 pm on Apr 26, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I haven't had perl installed on a Windows system for a long time now. So I went and grabbed the Activestate installer and installed it to C:\usr based on the advice of one Mr. Tabke [webmasterworld.com]. Doing so will insure that your existing scripts work just fine without modification as most often you will find the perl shebang line pointing to the perl interpreter in the same path. What I'm telling you is DO NOT use the default Windows path provided by Activestate. Create a folder in your root titled "usr" and leave your shebang line as
#!/usr/bin/perl

in your scripts and the interpreter will kick in and find it just fine. No need for DRIVE:\PATH syntax.

After the install you may need to reboot your computer to get the Windows PATH environment variable loaded in memory properly unless you know how to set it from the command line.

Next, set up your Apache httpd.conf file as mentioned in the link there and you should be good to go. It is your ScriptAlias directive that you want to get right and it won't hurt to set your <Directory> container up for the cgi-bin as noted in that message.

Hold on, I forgot you were on IIS. Man, it's been so long since I've used that HTTP server I cannot recall where you set the scripting engine information. Well, based on ScriptAlias you should be able to find the relative information either in the IIS forum here or on Microsoft support site.

Dabrowski

5:39 pm on Apr 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok, I have Windows 2000 Server/IIS running Perl just fine. W2K3 is the same setup I'll be upgrading shortly.

installed it to C:\usr

Why would you do that? C:\Perl is just fine, although it doesn't matter where it's installed as Windows uses file associations to find it.

leave your shebang line as
#!/usr/bin/perl

Second, Windows does NOT use a #! line, so that will be ignored anyway.

After the install you may need to reboot your computer to get the Windows PATH environment variable loaded in memory properly unless you know how to set it from the command line.

Maybe, from the commmand line you can type 'set' and check the PATH variable, or just type 'perl' and see if it finds it. Although you've probably done that much by now.

I cannot recall where you set the scripting engine information

Errr, which version did you use? You don't need to set anything manually. This is NOT *nix. When Perl installed it should have installed the ISAPI for IIS automatically.

You need to do nothing further to make your perl scripts work, except check in IIS that the site has 'scripts and executables' set on 'execute permissions' on the 'Home Directory' tab. If it doesn't it will just display the contents of the script rather than executing it.

Then just try a .pl script in your browser. This should work just let me know if you have any problems.

coopster

6:15 pm on Apr 26, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Apparently you didn't read my entire message or you at least overlooked the first sentence in my last paragraph :)

Hold on, I forgot you were on IIS.

You may certainly be correct about your statements here as I stated at the very close of my message I realized/remembered the OP was running IIS. I'm running Apache. The last time I ran any MS HTTP engine was back in the mid-90's. I had used PWS and then IIS as an add-on to NT. Over 12 years ago. Once I discovered Apache I never looked back. I will add a few responses below, they will not be relevant to the questions posed by the OP but for future readers that come across this thread who are running Apache I think it is important I clarify a few things ...

Why would you do that? C:\Perl is just fine, although it doesn't matter where it's installed as Windows uses file associations to find it.

Not entirely true, especially not true for Apache. There is a checkbox option during install to determine whether or not you want to set perl file associations in Windows. If IIS requires this setup I imagine you will want to make sure that checkbox is ticked. Personally, if I double click a script I want to edit it, not run it. User preference. However, for Apache users that will not matter anyway. You can either set a ScriptAlias and run scripts with any extension from the aliased directory, or you can add an "ExecCGI" to the "Options" directive to use CGI scripts outside of ScriptAliased directories and then set an AddHandler to tell Apache which file extensions should be parsed by the perl interpreter.

Second, Windows does NOT use a #! line, so that will be ignored anyway.

IIS may not use the shebang line but if it is missing on an Apache install the script will indeed fail as the interpreter will not be located. To port the code to a server other than IIS such as the Apache server, the shebang line must be present.

I cannot recall where you set the scripting engine information

Errr, which version did you use? You don't need to set anything manually. This is NOT *nix. When Perl installed it should have installed the ISAPI for IIS automatically.

You need to do nothing further to make your perl scripts work, except check in IIS that the site has 'scripts and executables' set on 'execute permissions' on the 'Home Directory' tab. If it doesn't it will just display the contents of the script rather than executing it.

Errr, I guess you did have to check it manually now, didn't you? :)
Anyway, that is what I believe I was trying to recall. Back when I was using IIS I had to trigger that option as you specified.

perl_diver

9:17 pm on Apr 26, 2008 (gmt 0)

10+ Year Member



Apache on Windows can also be setup to ignore the shebang line.

[httpd.apache.org...]

Not sure what all versions of Apache support the directive. The documentation should indicate that.

So a Windows user should be able to use a unix shebang line in all their perl scripts, be they CGI or not. That way when the scripts are moved to a Unix type of environment no modification is needed, at least not to the shebang line.

Not that this information is germane to the original question but I think it is to the supplemental discussion.

Dabrowski

9:45 pm on Apr 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nice post Coopster! Not much to add really.

I never used IIS that long ago....I was still in school! :)
Maybe Apache was a good alternative back then.

If IIS requires this setup I imagine you will want to make sure that checkbox is ticked. Personally, if I double click a script I want to edit it, not run it

IIS doesn't necessarily require it, you can botch it manually, but why would you? If you want to edit the scripts by double click you can change this action in the 'File Types' setup without breaking IIS.

check in IIS that the site has 'scripts and executables' set on 'execute permissions' on the 'Home Directory' tab

Quoting myself now, this is more of a permissions thing than a scripting setup thing, but yes you're right you do need to do this in addition if you didn't do it when you created the site in the first place.

Apache on Windows can also be setup to ignore the shebang line

Judging by what you and Perl_Diver said, you can tell that Apache started off in the UNIX world, nice to see they are starting to integrate with Windows properly though. Maybe soon they'll implement a GUI too?

Anyway, [b]Karma[b], I hope our little discussion has been useful, let us know how you get on.

coopster

10:27 pm on Apr 26, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You are correct, perl_diver, but the option is only available in Apache 2.0 and later. Even so, there is a potential issue using the Registry options as opposed to the Script option so be careful what you put in your ScriptAlias directory if you use this directive.

I never used IIS that long ago....I was still in school! :)
Maybe Apache was a good alternative back then.

LOL Dabrowski! C'mon, I'm not that old ;)
And Apache has always been good! Alternatives like IIS came along afterward.

IIS doesn't necessarily require it, you can botch it manually, but why would you?

Because I'm not running IIS. But as already recognized, Karma is and I already took us off topic once here today! Yes, the supplemental discussion has been great but I almost derailed this thread. There is some good reading in here but we will need to bring the focus back to IIS. Hopefully you can assist, Dabrowski, if there are any more IIS setup questions because I won't have a clue. We just didn't want to leave Karma hanging without some further direction. Thanks!

perl_diver

4:27 am on Apr 27, 2008 (gmt 0)

10+ Year Member



I know I'm correct, I've had this discussion on a few forums where people say that you "must" use the shebang line with apache on Windows. I don't blame people for not being aware of it, there are a lot of directives and that is really one of the more obscure ones. I thought maybe you were not aware of that because earlier you said the shebang line must be present. I was not sure which versions of Apache support that directive but it is listed as supported 1.3 and up. The Registry-Strict option is 2.0 or higher. As far as the warning, I am aware of it thanks.

[httpd.apache.org...]

Dabrowski

5:28 pm on Apr 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So Karma, did you get it working ok?

coopster

5:39 pm on Apr 28, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



supported 1.3 and up. The Registry-Strict option is 2.0 or higher.

Thanks for not only offering the correction, but the clarification.