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

On WINDOWS NT, I can run a .pl script, but not a .cgi? HELP? 3

Status
Not open for further replies.

garymgordon

Programmer
Apr 5, 2000
307
US
I have a Windows NT server that has Perl 5.005 installed.

It's path is C:\Perl\bin\perl.exe

With that being said, my problem is .. it isn't recognizing the .cgi extension.

I put:

#!c:\Perl\bin\perl.exe to start the script.

But when I call the file.cgi .. it just tries to download the file. Not an error, .. just won't execute. Just tries to download it.

How .. in Perl .. or what ever, can I modify things to it will also execute .cgi files in addition to .pl files.

I need some help!!

Thanks,
Gary
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
I am running it on Windows NT with IIS.

We downloaded Perl for Win32.

The problem is that it won't run perl scripts with the extension of .cgi.

??

What do I need to do, re-configure, etc.?????

Gary
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
Do you need to associate the .cgi extension with the perl executable? - the same way the .pl extension is associated with it. Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Hi Mike,

Yes.

I must be an idiot. That is EXACTLY what I am trying to do. hahahaha

For some reason, when the admin of our server set up Perl, it works with .pl , but not with .cgi scripts.

Previously they had PerlIS installed on the server. I doubt he removed it. I think he just added Perl for Win32 to the server.

So that's my story. I just need to this to work ... and for .pl and .cgi scripts to be able to run from any folder I have on the server.

Any advice?

Gary

THANKS!!

Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
Hey :) I answered a web question!

(I know so little about HTML, CGI and anything like that, it's embarassing.)

Glad you're sorted. Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Mike,

So, .. I guess you can't help? :(

Well, hopefully someone can.

haha

Gary

(I'm waiting for some brilliant person to help me.)

Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
From my experience IIS doesn't need the shebang line at all (#!). IIS knows where the interpreter is only after you add it to your site properties "Home Directory/Configuration". So unless there is an association with .cgi listed, they wont work regardless of weather or not the shebang line is correct.

If .pl is working I would have to assume your server is functioning and your calling your pages correctly. whats wrong with using .pl anyhow?

If it's that important maybe you ought to throw this at your admin and make it his problem. If he wont do it hurt him a little.

Maybe with some more info we can figure this out.
 
Thank you. :) I'll have him check that out.

I did throw it at that admin, ... but I wanted to try to help by pointing him in the right direction as to "what he needs to do". That was why I was asking.

Gary
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
I misread your reply, I thought you knew what I meant.

By "associate" I meant:

Open Control Panel.
Open Folder Options in Control Panel.
Click the "File Types" tab.
Click "New"
Type .CGI and then click "Ok"
Click "Change"
Choose "Perl Command Line Interpreter" from the list.
Click "Ok"
Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Mike,

haha

Thanks.

I will try this on Monday when I get to the office.

THANK YOU VERY MUCHO!!!

Gary
:)
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
:) Let us know how you get on. Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
I had the same trouble on win 2000 Pro I went to control panel,Administrative Tools, Internet information Services, Right clicked on Defult web Site, selected Home dir tab
selected Configuration press add for Extension I put .cgi
and as My .pl was I set Executable is C:\Perl\bin\perl.exe "%s" %s
and I limited My verbs, ok My question is the "%s" %s
what does "%s" %s do or mean?
 
Mike ...

I found the problem with the .cgi scripts not running. I really don't understand why .. but here was the problem.

The Admin had set up a virtual directory that all my files for the website are held in. The virtual directory name was composed of 3 words and there was a space between each word. Such as c:\Virtual Evidently the spaces were giving Perl a problem and I don't know how to fix this.

But .. the admin set me up with a new place that doesn't utilize spaces in the name of the folder.

But .. do you know the reason that spaces would have caused this problem and is there any way around it so I could continue to use the folder (with the 3 words and spaces between the words) .. or is this just something I absolutely need to avoid. Again, if you can explain why the spaces in the name of the folder would give Perl a problem, I would greatly appreciate knowing why, etc.

Thanks,
Gary
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
Don't know, Perl doesn't mind spaces in file names generally, this little script works ok on Win2k

open(F, "c:/my test dir/test.txt" ) || die $!;
while(<F>){
print;
}

It might be that your web server s/w doesn't like the spaces. Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
When you associated the file suffix with the Perl interpreter, you needed to put &quot;%1&quot; after the program name. The quotes help it keep all the parts of the Perl file name together.

Rose/Miros
 
Thanks.

Two things.

1) Miros .. what is this %1 thing and where exactly is it used when associating the .cgi with the Perl interpreter?

2) Thanks for the code snippet, but what does s/w mean in your note below the snippet?

:)

Gary
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
 
Errmm <grin> s/w = software Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top