Forum Moderators: coopster & phranque

Message Too Old, No Replies

Problems with locating the Perl interpreter

e.g. #!/usr/local/bin/perl

         

kevchadders

3:25 pm on Jul 1, 2002 (gmt 0)

10+ Year Member



Currently I'm trying to learn perl/cgi stuff… At the moment I have created an example CGI script, for my companies web site. It just records page hits... I got it from ratlog (http://www.absolutefreebies.com/directory/ratlog.html).

I tested it on my machine and it seems to work fine but my problem is that I’m not sure where the perl interpreter is located on the server, for my perl scripts to work.

I’ve tried this as the first line…

#!/usr/local/bin/perl

…to run the Perl interpreter, but it doesn’t seem to work.. I’ve also read that you can type ‘which perl’ to find where the Perl interpreter is located. But that’s the Unix command, and I’m using win2000 server. I understand that the first line basically tell the script the directory location of the perl interpreter. Is there other ways/tests I can do to find this location?????

I’m thinking of phoning up the web hosting company for my web site, to ask them… I’m guessing that they should know??? Anyone got any thought on this???

Thank for any help!

Allen

3:51 pm on Jul 1, 2002 (gmt 0)

10+ Year Member



The most popular alternative is /usr/bin/perl

If that fails, ask you webspace provider.

If you have shell access to the machine, try the command 'whereis perl'.

Regards,

Allen

Brett_Tabke

7:39 am on Jul 8, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



If it is a windows box, you might also try looking in /Perl

You could also just try
#!perl

Which will work if perl is on the system path.

stigsb

6:56 am on Jul 10, 2002 (gmt 0)

10+ Year Member



A trick that works on all Unixes I've tried is:

#!/usr/bin/env perl

- Stig