Getting MC CGI to work on OS X with "Web Sharing" turned on
Ken Ray
kray at sonsothunder.com
Sat Oct 18 12:56:25 EDT 2003
OK, I finally got it to work, and I'll be writing up a tip on it right
away. :-) But for those taking notes, here's the steps:
1) Turn on Personal Web Sharing in the Sharing control panel (which told
me my web address was "http://192.168.1.100/~kenray/"). This creates an
index.html file in the Sites folder on your hard drive (in my case it
was /users/kenray/Sites/).
2) Download the Darwin MC CGI from the Metacard web site, decompress it
down to its "mc" file, and put it into folder
/Library/WebServer/CGI-Executables.
3) Place your CGI script in the same folder as the "mc" file. Mine is
called "simple.cgi", which simply dumps "Hello World" as a result. It
looks like this:
!#mc
on startup
put "Hello World!" into tResponse
put "Content-Type: text/html" & crlf
put "Content-Length:" & the length of tResponse & crlf & crlf
put tResponse
end startUp
4) Set the permissions on both files to at least 755 (I used 777 (just
in case)).
5) Open up Terminal, do "cd /library/webserver/cgi-executables/" to get
to the CGI-Executables directory, and execute "./mc simple.cgi". You
should get back this:
Content-type: text/html
Content-length:12
Hello World!
6) Then, open up your browser and type the IP address you were given in
the Sharing control panel, followed by "/cgi-bin/simple.cgi". In my case
it was:
http://192.168.1.100/cgi-bin/simple.cgi
You should get "Hello World!" showing up in your browser.
As Dave noted, the /Library/WebServer/CGI-Executables directory can be
referred to as "cgi-bin" in your urls.
7) Create the rest of your site in the Site folder and when you want to
refer to the CGI, simply use <IP>/cgi-bin/<script>.
Thanks for everyone's help!
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
> -----Original Message-----
> From: metacard-bounces at lists.runrev.com
> [mailto:metacard-bounces at lists.runrev.com] On Behalf Of Ken Ray
> Sent: Saturday, October 18, 2003 11:37 AM
> To: 'Discussions on Metacard'
> Subject: RE: Getting MC CGI to work on OS X with "Web
> Sharing" turned on
>
>
> > >Ok, I put them there (both the "mc" app and my
> "simple.cgi" file (I'm
> > >using .cgi instead of .mt)), but when I attempt to call on the cgi
> > >directly from the address bar of safari by typing:
> > >
> > >http://192.168.1.100/~kenray/cgi-bin/simple.cgi
> > >
> > >I get a "Not Found" page saying that "the requested URL is
> > not found on
> > >the server.
> > >
> > >What am I missing?
> >
> > Try this:
> >
> > http://192.168.1.100/cgi-bin/simple.cgi
> >
> > The cgi-bin "alias" is for the whole domain. If you want separate
> > cgi-bin folders for each user account, you'll need to edit
> the Apache
> > config file (/etc/httpd/httpd.conf). Don't ask me how.
>
> Thanks, Dave, but when I use the URL you suggested, I get a an error
> 403: "You don't have permisson to access /cgi-bin/simple.cgi
> on this server".
>
> I'm still stumped.
>
> Has anyone out there actually set this up on OS X and can
> provide step-by-step instructions? It should be the same for
> every copy of OS X out there who has simply turned Personal
> Web Sharing on and wants to run a CGI...
>
> Ken Ray
> Sons of Thunder Software
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metac> ard
>
More information about the metacard
mailing list