Home  |  Linux  | Mysql  | PHP  | XML
From:WordWeaver Date:Sun Jul 20 14:34:18 2003
Subject:How To Set CGI Paths On Mac-Based Website?
Hello,

This is my first post to this list, and I am hoping that
someone can offer me a hand.


Very briefly, we have two web sites. One is a graphic 
version run on a server down at our local ISP, and the other 
is a text version which we run from our home on a Macintosh.

While I have been running our sites for over six years now, 
this is the first time that I have ever attempted to run cgi 
scripts on this home machine, and it is proving to be quite 
a challenge.

The main problem seem to be my lack of a total understanding 
of how to properly use cgi scripts -- which were designed 
for Unix machines -- on our Mac.

More specifically, the problem has do with setting the paths 
properly. While these scripts work fine on our ISP's server, 
when I try to run them on the Mac, they throw me an error 
saying that the file or folder can't be found. I have tried 
a number of different paths, but still get the same results: 
the files are not being indexed, because the file or folder 
cannot be found or does not exist...or at least so I am 
told by the script.

On the Mac in question, we are using the personal web 
sharing feature of OS 9.2.2. The latest version of MacPerl 
is installed on this machine. It has adequate RAM and runs 
fine. There are also no problems with the web site itself. I 
have also taken the cgi's I downloaded from the web, and 
opened them with MacPerl, and saved them as cgi scripts so 
that they are no longer text files. I have also already 
added the cgi's to the "Actions" palette in the "Web 
Sharing" control panel.

My first big question has to do with the string:

#!/usr/local/bin/perl

My original understanding was that I had to create a folder 
hierarchy just like that, inside of the folder I have 
designated as the web sharing folder, and place MacPerl, and 
all of its associated files in the "perl" folder...but now I 
am not sure if that is correct or not.

Being as I am running the server on a Mac, do I need to 
change those forward slashes in the string to colons?

At a certain web site, I read that "usr" is actually the 
name of the hard disk where the perl program resides. Does 
this mean that in that string, I have to change "usr" to the 
actual name of the hard drive...or does the perl program, 
(MacPerl), look at that "usr" and automatically know to 
fetch the real name of the hard drive?

Also, from what I read, it sounds as if that string needs 
to point all the way to the interpreter itself, that is, to 
MacPerl, and not just to the folder which encloses the 
MacPerl program. Is this also correct?

If "usr" must be the actual name of the hard drive, then I 
will have a better idea of part of what is wrong here.

If, for example, my hard drive is called "Macintosh HD", and 
the MacPerl program is inside the "MacPerl 5.8.0a2 folder, 
which is inside of another folder called "Programming", 
would I change that above string to read:

#!/Macintish HD/Programming/MacPerl 5.8.0a2/MacPerl

Or maybe to:

#!:Macintish HD:Programming:MacPerl 5.8.0a2:MacPerl:

So basically, what I am asking is where does MacPerl need to 
be installed? Inside of my web sharing folder, (where it now 
resides), or outside of the web sharing folder...and do I 
need to change that string found at the top of every Perl 
script or not?

My second question, also a path question, has to do with 
setting the proper $basedir path. This "full server path" 
stuff just leaves me totally confused. The baseURL is easy, 
because it is just a regular web URL pointing to a specific 
folder or file on our web site, but this $basedir is the one 
that really stymies me, because I don't know where it is 
supposed to begin. What is its point of reference?

For example, I know that the end of the $basedir path has to 
point to the folder of files I wish to be indexed by the cgi 
script, but what is the beginning of the path supposed to 
be? The "full server path" is supposed to start where?

1. With the actual name of the hard drive?

2. With the name of the folder which I have designated as 
the web sharing folder?

3. With the folder where MacPerl is located?

4. With the folder where the actual cgi script is located?

If someone on this list can answer these few questions 
clearly for me regarding:

1. the #!/usr/local/bin/perl string
2. the $basedir path
3. when and where to use : instead of /

then I think I might have more success at getting these 
scripts to work.

BTW, the simple search engine cgi I am using actually has 
two cgi's. The search cgi which is used by our visitors 
works fine. It knows how to find the database file which is 
inside of the same folder as the script itself in the 
cgi-bin. It is the index.cgi, which I must use to update the 
database file, which is throwing me the errors, telling me 
that the folder or file cannot be found or does not exist.

I will probably have a few more questions, but as I said, if 
I can get help with exactly how my physical setup is 
supposed to look, and how to set the paths right, I may be 
able to solve things quickly.

Thank-you for your time and attention. I hope to hear from 
someone on this list at your earliest convenience.

Thank-you in advance,

The WordWeaver

Navigate in group perl.macperl.webcgi at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants