Re: Running CGI's locally on OSX

2002-07-08 Thread Sadhunathan Nadesan


Well, Swami, I should probably remain silent on this, not having an OSX
around - but the quick and fraught with peril answer may be  - log in
as root.

(I would expect to hear back a few "no, don't do it!" responses from
seasoned Unix veterans, because it lets you overcome all sorts of
permission problems instantly without knowing what you are doing.)

Again, I really don't know enough about your environment but I'd suggest
you try it to see what happens.

Sadhu


| Message: 2
| Date: Wed, 03 Jul 2002 18:13:05 -1000
| Subject: Running CGI's locally on OSX
| From: Sivakatirswami <[EMAIL PROTECTED]>
| To: Metacard List <[EMAIL PROTECTED]>,
| <[EMAIL PROTECTED]>
| Reply-To: [EMAIL PROTECTED]
| 
| I have moved up to OSX (it's wonderful) and want to develop CGI's on my own
| machine. The mail lists have snippets, but not enough to put it all
| together.
| 
| I put a copy of the darwin engine into
| 
| /Library/WebServe/CGI-Executables/
| 
| But, that's as far as I can get, the terminal.app on -ls returns only my
| user directory. "/" returns permission denied...so OSX won't let me deeper
| than my own user directory to CHMOD 755 to make the engine executable.
| 
| Anyone figure this out yet? If so, suggest you would help us all to write a
| small FAQ on the subject.
| 
| Now, I am wondering if we need to use that library at all, really, if one
| just made a cgi-bin directory in one's own "Sites"  folder, then one could
| set permissions from the terminal.app. But, I don't want to re-invent the
| wheel just now. This has got to be simple.
| 
| Hinduism Today
| 
| Sivakatirswami
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Running CGI's locally on OSX

2002-07-05 Thread Sivakatirswami

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

> on 07-05-2002 06:01 AM, Mark Paris at [EMAIL PROTECTED]
> wrote:
> Try #! /Library/WebServer/CGI-Executables/Darwin 2
> On the first line
>  And
> on Thu, 04 Jul 2002 13:17:12 Richard MacLemale at <[EMAIL PROTECTED]>
> 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
>From the command line:

chmod 755 darwinEngine myCGIscript.cgi

4) from command line run

ls -l to check on your permissions which should now read

rxw r-w r-w for both files

Which means: owner can read, execute and write, groups can read and write
only and the public/world can read and write only.

5) See http://mitchellonline.pasco.k12.fl.us/training/metacardcgi.htm

For more detailed explanation (Note his explanation uses Metacard...and fyi
you do not need the tools, home stack.. Only the engine is required)

6) in your browser enter

http://my.machine.ip/cgi-bin/test.cgi

To test.

7) Sample test script below. The first line is critical. It can be either

#! /Library/WebServer/CGI-Executables/darwinEngine ## for clarity
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

Or the first line can be simply

#!darwinEngine ## no slash at the beginning,

If the above works you can skip the following step

8) If you find your script is not always running every time it is called you
may need to open  this file in BBEdit by looking for hidden files in the
root directory: (very carefully!)

/etc/http/httpd.conf

And uncomment this line:

 # AddHandler cgi-script .cgi  [becomes:]
 
AddHandler cgi-script .cgi

Go to System preferences and turn web Sharing and off and then on again to
reboot Apache to get Apache to load the new httpd.conf

Now, this should not be necessary, but may be... Try without first. This
will also allow you to place the engine and scripts in a cgi-bin anywhere
else on your hard drive (in your "Sites" directory for example)  But there
are security issues if you do the latter: go to

http://www.macdevcenter.com/pub/a/mac/2001/12/14/apache_two.html

For more information and also a simple guide to using terminal.app if you
are complete unix newbie. If you have more questions, post them to the list.

END PRIMTER ON INSTALLING DARWIN TO RUN AS FACELESS CGI ENGINE ON MAC OS X
LOCAL MACHINE












Om shanti,
Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
[EMAIL PROTECTED] 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org

Read The Master Course Lesson of the Day at
http://www.gurudeva.org/lesson.shtml

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Running CGI's locally on OSX

2002-07-05 Thread Richard MacLemale

On 7/5/02 12:02 PM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> "Premature end of script headers" error message in the error_log when trying
> 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.

Couple of things to try.  One, I use #!mc and not #!/mc, but that's probably
not your problem.  However, make sure that the script file you wrote is
saved with UNIX line breaks!  Not Mac line breaks.  If you haven't already,
grab a copy of Bbedit lite, which is free, free, free and awesome.  It can
easily save your script with UNIX line breaks.  I'd guess that's the
problem.

-- 
:)
Richard MacLemale
Network Administrator
J. W. Mitchell High School

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Running CGI's locally on OSX

2002-07-04 Thread Richard MacLemale

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!

One other non-documented thing.  You can give a script permission to run as
root, meaning it can do anything root can do.  This is sometimes handy for
pulling off stuff that would otherwise not be possible.  But it opens up a
security hole, in that if anyone figured out a way to modify the script they
could do serious damage.  But so long as the script is owned by root and the
group and everyone privs are read only, you should be safe.

I've been using darwin mc with CGI scripts to help run my high school
network for a while now, and it IS the coolest thing ever.


-- 
:)
Richard MacLemale
Network Administrator
J. W. Mitchell High School

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Running CGI's locally on OSX

2002-07-03 Thread Sivakatirswami

OK, see previous post... I "hit the books" and was able to do the following

Put the Darwin engine in the two places  /Users/katir/Sites/cgi-bin/

And also in the /Library/WebServer/CGI-Executables/

I figured out how to use the terminal.app on OSX and went in and CHMOD
everything to  755 (both engines in both places, the cgi-bin in my own Sites
folder and my test script below.)

#! /mc
On startUp
Put "hello"
End startUP

If I invoke the cgi from my browser

http:/my.machine.ip/~katir/cgi-bin/test-mc.cgi

It just returns the ascii text of the cgi... I.e. Nothing is executed...
Same thing happens if I change the path to the engine to:

#! /Library/WebServer/CGI-Executables/mc


Still no go... 

Any clues?


Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
[EMAIL PROTECTED] 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org

Read The Master Course Lesson of the Day at
http://www.gurudeva.org/lesson.shtml

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Running CGI's locally on OSX

2002-07-03 Thread Sivakatirswami

I have moved up to OSX (it's wonderful) and want to develop CGI's on my own
machine. The mail lists have snippets, but not enough to put it all
together.

I put a copy of the darwin engine into

/Library/WebServe/CGI-Executables/

But, that's as far as I can get, the terminal.app on -ls returns only my
user directory. "/" returns permission denied...so OSX won't let me deeper
than my own user directory to CHMOD 755 to make the engine executable.

Anyone figure this out yet? If so, suggest you would help us all to write a
small FAQ on the subject.

Now, I am wondering if we need to use that library at all, really, if one
just made a cgi-bin directory in one's own "Sites"  folder, then one could
set permissions from the terminal.app. But, I don't want to re-invent the
wheel just now. This has got to be simple.

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
[EMAIL PROTECTED] 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org

Read The Master Course Lesson of the Day at
http://www.gurudeva.org/lesson.shtml

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard