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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This is my 3rd post for this problem..... must be a real challenge?

Status
Not open for further replies.

Tels

IS-IT--Management
Jul 10, 2001
290
0
0
GB
Hi, I posted a message a while ago but didnt get a reply, I have installed ActivePerl on a Win2000 Server machine, used the MSI to install and it all went smoothly, the .pl extension has been related to the perl application, and the cgi-bin directory has full permissions (I'll be more restrictive once I know how it works)

I have downloaded a perl script (printtime.pl) to print the time and date, and I have installed this in the cgi-bin. When I run the script at a CMD prompt, it works perfectly. I think maybe that the line I am using in the shtml page is wrong, because when I call the perl (from the page) with

<!-- #exec cgi:&quot;/prcserver/printranet/cgi-bin/textclock.pl&quot; -->

I get a page back with:

Cannot #EXEC '/prcserver/printranet/cgi-bin/textclock.pl' due to lack of EXECUTE permission

Now I know that at some point the page is handled by CGI, because of the embedded error message, but where am I going wrong??? HELP!!!!

PS when I run the script from the same dir like this:

<!-- #exec cgi:&quot;../textclock.pl&quot; -->

I get:

Failed to execute script '../textclock.pl': Win32 Error Code = 2

What does this mean? I've spent hours on the web trying to find out, none of the perl sites seem to give you any useful info on this kind of thing.

Another useful thing to know would be the path equivalent: I know that when you use SSI (Server Side Includes) the path to the CGI/PL script should be relative to that machine or fully qualified, if a *nix script has /foo/bar/script.pl/ as a path, what would the equivalent path be in NT? Could you use C:/foo/bar/script.pl/ or does other syntax rules apply?

What of the shebang??

It's a bit hard right now cos ANYTHING could be messing the server up right now....

With your help I will be on my way
Thanks all

Tels Win2000 Network Administrator
 
Well, first off I don't know a thing about Windows web servers but have you tried any of the following:-

i, Check that any simple SSI will work.
<!--#echo var=&quot;SERVER_NAME&quot;--> for example. Maybe your server isn't configured to run SSIs.
ii, Should there be a colon after the command 'cgi' in your SSI? There is no colon in any of the examples of SSIs I've seen.
iii, Being Windows I imagine it will need the C:// at the start of the path. Why not try both.
iv, I don't think Windows takes any notice of the shebang since I think scripts are associated with Perl by their extensions.
v, Is it possible that script you are using has been written for a *nix environment/server and just doesn't work on Windows? Can you try a different more simple script just to check you're getting any output at all.
vi, Try calling your script from an HTML form to see if that works.
vii, (Re)Check the permissions of every file involved in what you're trying to do.

Like I said I don't know anything about Perl under windows servers but I thought I'd have a stab anyway.

paulf
 
Hi,

I'm running a local intranet under both window NT 4.0 and on a Linux Apache Web Server. My actual internet site is hosted by Hostway at
I had to set a few option with the Internet Service Manager before my Microsoft Information Services 4 would work.

I clicked on start-->program--Windows NT 4.0 Option Pack-->Microsoft Internet Informations Server-->Internet Service Manager. Access to the Internet Service Manager might be completely different in you system.

I then right clicked on my cgi-bin directory and selected properties from the drop dow box. A form appeared with about five tabs. Under the first tab labeled [Virual Direcory] I entered the correct full local path to my cgi-bin directory. There is a browse window if you perfer. I check the following check boxes under the
Access Premissions:

Read
write
Log access

I check the following under permissions:

Execute (including scripts)

Once this was done, I was able to execute my cgi-bin perl scripts using a virual path of &quot;/cgi-bin/somescript.pl&quot; You might also want to right click on the default web site-->properties and make sure everything in the form that appears is the way you want.

Also, I right clicked on my cgi-bin directory from the windows explorer and selected properties. A form appeared. Under the [Web Sharing] tab I select [Default Web Site] for the [Share on] label. I clicked on the Share this folder circle. I click on the Add button next to the alias box and added /cgi-bin

Hope this helps.

Leland
 
Well, Thanks for your replies so far, the problem remains, but there is more info you lot might find interesting:

CGI scripts appear to work fine, as long as they don't require SSI. I still cannot figure out why though... PS I absolutely MAXED permissions out on both the cgi-bin and the dir where the ssi was called - I cannot work out what it is I need to do, I think it might be something like using a particular extension etc.....

Thanks for all your help

Tels
Win2000 Network Administrator
 
O! And theres more: When I tried the script (echo var=&quot;SERVER_NAME&quot;) I got a reply, and the correct reply to be sure. However, the EXEC refuses to work. I think maybe this needs some tweaking.... any suggestions?

Cheers for all your help..

Tels
Win2000 Network Administrator
 
Tels

This how we used to call our scripts with SSIs when I used to work for a dotcom. All our servers were Linux but it might be worth a try.

<!--#include virtual=&quot;/cgi-bin/script.pl&quot;-->

paulf
 
I forgot to add that because the path is virtual it's not the full root path on your server but the path as if you're linking like an href.

paulf
 
Hi

Start up your Internet Service Manager and then right click on your cgi-bin directory. A Form will appear. Under the [Virtual Directory] tab, locate the [Application Settings] label. Click on the Configuration Button and another Form appears. Scroll the drop down list until you find the following:

Extension Executable Paths
------------ ---------------------
.pl F:\Perl\bin\Perl.exe “%s” %s

The path to your perl.exe file will vary depending where you installed perl. This was automatically set up for me as a part of installing Active Perl. You can highlight the above and then select edit to bring up another form. Notice the information contained in each field. Then select cancel. If you wanted to map the .cgi extension so IIS would use perl to execute perl scripts with a .cgi extension this can easily be done. Select the add button next to the edit button and fill out the form exactly like for the perl entry except substitute .cgi for .pl.



Leland
 
ActivePerl doesn't have a built in server. Have you tried using a Sambar or Xitami server? Or using Indigoperl with its built in Apache server?
 
The shebang syntax for Windows is:

#!C:/perl/bin/perl.exe

I imagine that whatever is in your shebang would override the Windows file extension association. Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
Hi Tels,

One other thing you may need to do is assign premission for the internet user to access your cgi-bin directory. Make sure that IUSR_*, where * is the NetBIOS make of your computer, has permission to use the cgi-bin directory. Since my computer is named JACKSON, my internet user is IUSR_JACKSON. The IUSR_* user is the equivalent of the nobody or apache user in a Linux or Unix system.


Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
In reply to other suggestions above:
ActivePerl on Windows does not need ANY shebang provided that the perl installation has correctly set up the PATH.
However, be sure that no other version of perl is present!
I previously suggested trying this on other web servers in order to determine if the problem lies with perl itself or in your webservers configuration.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top