Running CGI's locally on OSX

Mark Paris mparis at
Fri Jul 5 08:59:01 EDT 2002


Try this one instead---I just changed the first line.  Make sure the Darwin
engine is in that directory and chmod'ed to 755, and put your script in
there for good measure (755 also) and then try to run it as

If that doesn't work, try my original "hello" script verbatim from my post a
few days back, with the same directory structure/placement.  I think you
must be close!  I know I found it very frustrating to have a system with so
much ability and so little documentation.  I don't know what Apple is
thinking, but it seems that they want to give a great product, yet keep the
instructions on how to use it a big secret.  Lol.  ?!

Anyway, let me know if it works for you!


#! /Library/WebServer/CGI-Executables/Darwin 2
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

----- Original Message -----
From: "Sivakatirswami" <katir at>
To: "Metacard List" <metacard at>
Cc: <use-revolution at>
Sent: Thursday, July 04, 2002 9:22 PM
Subject: Re: Running CGI's locally on OSX

> > From: "Mark Paris" <mparis at> wrote
> >
> > What do you get when you try:
> >
> > http://my.machine.ip/ or http://localhost/ ???
> >
> [SNIP]
> Thanks Mark, the macDevCenter page on Apache for OSX was useful, if only
> help get some more terminal skills up and running...and yes, you are right
> http://my.machine.ip/cgi-bin/ does map to the /Library/ and I am getting
> default Apache page...
> OK,  I uncommented the httpd.conf file at the point where the
>  AddHandler cgi-script .cgi
> As this was the sole semi- related recommendation and also recommended by
> Richard MacLemale last year... (Though that should not affect running
> in the /Library/WebServer/CGI-Executables/ which should be enabled by
> default...according to the MacDevCenter article)
> Theoretically there is nothing else to do.  OK. So far so good,  but, now
> am getting a
> "Premature end of script headers" error message in the error_log when
> to  call this script:
> ======test-mc.cgi
> #!/mc
> 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
> =========
> I don't know if this means that the MC Darwin engine is working or not...
> Anyone else have clues? Again, seems simple, but doesn't work.
> recap:
> --Darwin engine downloaded and installed into
> /Library/WebServer/CGI-Executables/
> --And the above test script as well... Both files permissions set to CHMOD
> 755
> --"AddHandler cgi-script .cgi " was enabled in the httpd.conf file
> --But http://my.machine.ip/cgi-bin/test-mc.cgi still doesn't work
> --Error log says: "Premature end of script headers:
> /Library/WebServer/CGI-Executables/test-mc.cgi"
> Hinduism Today
> Sivakatirswami
> Editor's Assistant/Production Manager
> katir at
> Read The Master Course Lesson of the Day at
> _______________________________________________
> use-revolution mailing list
> use-revolution at

More information about the Use-livecode mailing list