.cgi, .pl , other confusing letters

They have: 5,633 posts

Joined: Jan 1970

Ok So im learning perl. Im somewhere in the middle of it. I got it installed on my IIS after a few hours. Now I have a friend hosting my site and it says it can run "cgi scripts" witch i thought was .pl and .cgi. But everything i try to get them running doesnt work. I even put the stuff in the cgi-bin. What am I missing!

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

It has been a while since I worked with PERL, but one thing that comes to mind as being something to check on is the first line that tells the script where PERL is located, it should look somthing like (from a FreeBSD server):

#!/usr/bin/perl'

Where perl is at on your system and where it is on your friend's server may be different. This would be the first thing I would check. (although I've never tried PERL on a windows server).

-Greg

druagord's picture

He has: 335 posts

Joined: May 2003

on a IIS server it should look more like

#!c:\program files\perl\perl
'

if his server can run cgi script ask him he should know where it is. this line being wrong you should get error 500 internal server error premature end of script headers. if you see the script as text in your page then it's the mime type that is not set correctly on the server.

IF , ELSE , WHILE isn't that what life is all about

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I don't see this very often in scripts, but its a great debug help..

use CGI::Carp qw(fatalsToBrowser);
'Stick it near the top. You'll get more usefull info than a default Error 500.

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 5,633 posts

Joined: Jan 1970

I tryed both headers and i got an error with the debug thingy. It works on my IIs but not on my friends server.

druagord's picture

He has: 335 posts

Joined: May 2003

$myhost> error message : unable to compute please supply more data

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Most of time cgi scripts won't run it is because of permission problems. Need to make sure that it has execute permission by everyone.

druagord's picture

He has: 335 posts

Joined: May 2003

no specify execute by the webserver user only usualy IUSR_HOSTNAME on IIS

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

druagord wrote: no specify execute by the webserver user only usualy IUSR_HOSTNAME on IIS

I don't know if it is on IIS or Apache. He said that his friend is hosting his site now but no mention of the server type. I would think that if there is a cgi-bin directory then it is Apache though.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

druagord's picture

He has: 335 posts

Joined: May 2003

IIS use the same directory structure for cgi-bin well it used to when i was still using MS a long long time ago

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

By default cgi-bin is not installed with IIS.

druagord's picture

He has: 335 posts

Joined: May 2003

no but you should set it up when installing perl. in the same way that you can allow cgi execution in all your web site by setting Options +ExecCGI in apache IIS is configurable to use a script directory or not

IF , ELSE , WHILE isn't that what life is all about

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.