Running CGI's locally on OSX

Sivakatirswami katir at hindu.org
Fri Jul 5 14:54:00 EDT 2002


OK, this is solved now... See below for the "skinny Primer"

> on 07-05-2002 06:01 AM, Mark Paris at use-revolution-request at lists.runrev.com
> wrote:
> Try #! /Library/WebServer/CGI-Executables/Darwin 2
> On the first line
>  And
> on Thu, 04 Jul 2002 13:17:12 Richard MacLemale at <metacard at lists.runrev.com>
> wrote
> Ask and ye shall receive...
> 
> http://mitchellonline.pasco.k12.fl.us/training/metacardcgi.htm
> Let me know if there's any mistakes in it, because I wrote it half a year
> ago.  Also, there's one important piece of info that I think I left out.
> When writing a cgi script for darwin mc, the script must contain UNIX line
> breaks, NOT Mac line breaks.  Which means you can't write it in TextEdit or
> SimpleText.  The best, easiest way to do this is to grab a free copy of
> BBEdit Lite, which can save files with UNIX line breaks.  Then you're off to
> the races!

Yes, this now works! :
======test-mc.cgi
#! /Library/WebServer/CGI-Executables/mc #or whatever engine filename
on startup
put "Hello" into buffer
  put "Content-Type: text/html" & cr
  put "Content-Length:" && the length of buffer & cr & cr
  put buffer
end startup

But (duh!) 

#!mc

On the first line will also work. Putting a slash in front when the engine
filename was obviously the wrong thing to do (Unix thinks it's a directory)

So.. It was a "path thing" that was the trouble... OK, that's a wrap. And,
Richard... You page looks good except
a)  Yes, we need to document using Unix endlines (I did use BBEdit and I
just save scripts that way as standard procedure... So I also didn't think
about it, but needs to be told..." and
b) you only need the one file -- the engine itself (no home stack tools etc)
in the CGI-Executables

Thanks for everyone's input... What a great forum!

=============Kevin... Someone could polish this for a tip of the week:

SKINNY PRIMER: installing faceless Metacard or Revolution
On your MAX OSX machine for running CGI's on your own machine:

0) Go to system preferences and turn on Web Sharing

1) Download the Darwin engine, untar and put it in:
/Library/WebServer/CGI-Executables

2) Put your CGI script in the same folder: but, caveat: be sure to save your
script in BBEdit as generic text with Unix endlines

3) Using Terminal.app... Navigate to CGI-Executables and then run


More information about the use-livecode mailing list