Helpful Information
 
 
Category: Perl/ CGI
Configuring Perl :o)

I'm getting myself all worked up about this, but I imagine it is one of the easiest things to do.

Can you help me? Here is my problem.

I have recently downloaded the program Perl, with the intention of configuring my scripts on my machine before uploading them onto my site to save bandwidth usage. However, the settings I have to use for the 'Path to Perl' and Sendmail is "C:\BLAH\BLAH\USR\BIN\PERL.EXE".

What I'd like to know is how web servers make this into just #/usr/bin/perl. As when I change to this, it refuses to operate properly.

I am currently running Apache on Windows ME and everything seems fine other than this.

What do I need to do to make this work?

Any Help would be hugely appreciated.

Thanks in advance.
Leon

The shebang line (#!) is used to giva a path to the perl interpreter.

On a windows system, this means all your perl scripts must start with #!c:\blah\blah\usr\bin\perl.exe

and before you upload to your unix box (or web server) you need to change this to #!\usr\bin\perl

If you have a good text editor that can do a replace on multiple files, this is pretty easy.

If you put perl in your apache folder and configure the sub-directories to match your server.

Example:
On you server the path to perl is \usr\bin\perl

so on your computer you would need to place the perl executable in c:\blah\blah\apache\usr\bin\perl

Then you can use the same #! line for both. On the web server, it's an absolute path, and on your comp it's a relative path, but they both work the same!

Oh, I just thought of another thing which I think works, If you modify your PATH variable in DOS to point to the PERL exe you can call perl from anywhere.

You can do this by the following,
Goto DOS
type:
SET PATH=%PATH%;c:\blah\blah\usr\bin\perl.exe

then hit return.

Then, if I remember correctly, perl will execute from anywhere on the machine. Someone can check this for me though.

Yep, and if you downloaded the ActiveState Windows Perl interpreter this should have been done automatically.

You don't really need to worry with the shebang line in windows too much after you've got this done, so what I do is for my windows machine scripts, I put #!/usr/bin/perl for the shebang line, since this is what my remote webhost requires.










privacy (GDPR)