[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Newbie CGI Questions



Perry,

   I'd like to help but am having a little trouble with understanding 
your question.

>I'm executing the following at my Web location 
>http://www.devdrvr.net/unfetm/Feedback.html and getting a 404 error.

I get a 500 error, which is entirely different.

4xx errors mean the http server can't find the file.
5xx errors mean the CGI generated an error.

>I think the problem is that the sample I'm using is for the Mac and 
>I need to execute and put one on my server that is Apache specific 
>because that is the machine I'm using as a server in LA.

Mostly, the source code for Mac and *nix CGI scripts are very similar 
if not identical.  Because interprocess communication is utterly 
different on *nix and Mac, Mac CGIs have to be saved in an unusual 
file format that will not work on a *nix box, but the original, text 
version of the CGI usually will.

Because you don't supply any code for the CGI, however, I can't say 
more than that.  If you can post your CGI code, I (and some of the 
rest of us) can look it over.  This probably should be posted to:
macperl-webcgi@macperl.org
...rather than this group.

>If I do this and put the above in my browser go to line will the 
>.cgi execute or is there more that I need to do?

There is a lot that has to be correctly set up to execute a CGI on a 
*nix server, but usually most of that has been set up already:
1) You have to make sure that the directory that contains the CGI is 
one in which CGIs are allowed, and that the action URL points to that 
directory.  Apache is capable of some pretty fancy redirection.
2) You have to make sure that the ownership and permissions of the 
CGI are set so that it is readable and executable by Apache.  (Apache 
can be configured to run as a variety of different users, almost 
never you.)
3) You have to make sure that the CGI is correctly written Perl.  You 
sometimes can test this by running it from the command line, noting 
that the environment, etc. is totally different.

>if I do want to use MacPerl can I save as .cgi and use the proper 
>Unix directives and have it work on an Apache server or do I have to 
>use a Linux box and Perl there to do this correctly.

I think developing CGIs to run on a Unix server is one of the best 
uses of MacPerl CGIs.  (I discuss this some in a column I wrote for 
PerlMonth:
http://www.perlmonth.com/columns/mac_perl/mac_perl.html?issue=11 )
The main thing you have to note, however, is that the file format of 
the CGI that you test on the Mac and that you transfer to Unix are 
utterly different.  During development, you save from MacPerl as a 
CGI.  Once you are ready to transfer it to your Unix server, you save 
from MacPerl as plain text.

-David Steffen-
David Steffen, Ph.D.
President, Biomedical Computing, Inc. <http://www.biomedcomp.com/>
Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org