From: Tim Johnson
Subject: Deploying as CGI
Date: 
Message-ID: <slrne35jht.mop.tim@linus.johnson.com>
Hi: 

This is for the most part general topic question, so pointers to
some docs or discussions might be sufficient.

FYI: I'm an experienced web programmer, but new to LISP.

I'm looking at this link below:
http://www.codecomments.com/archive274-2005-11-690117.html

There are references to using REPL remotely, and connecting to running
applications. A specfic question I have then is:

What privileges will I need (on a *nix-style server) to accomplish
deploment and testing of a cgi application?

Thanks
(tj)

-- 
Tim Johnson <···@johnsons-web.com>
      http://www.alaska-internet-solutions.com

From: Pascal Bourguignon
Subject: Re: Deploying as CGI
Date: 
Message-ID: <87fyktdnvh.fsf@thalassa.informatimago.com>
Tim Johnson <···@johnsons-web.com> writes:
> I'm looking at this link below:
> http://www.codecomments.com/archive274-2005-11-690117.html
>
> There are references to using REPL remotely, and connecting to running
> applications. A specfic question I have then is:
>
> What privileges will I need (on a *nix-style server) to accomplish
> deploment and testing of a cgi application?

CGI are relatively antinomic to REPL.

The principle of CGI is to launch a new instance of the script
everytime a request is made.

The REPL is useful for a persistent process, running continuously,
where you can modify the running program while processing new
requests.

Now, it's possible to mix both, using things like FastCGI: the CGI
script just sends a request to a continuously application server.  A
less complex configuration would be using mod_lisp in the web server
to communicate with the application server (which would run for
example UCW), or running directly an HTTP server inside the
application server (eg. Araneida).


Anyway, to answer to your question of priliveges needed to deploy and
run a CGI application, it really depends on the setup and
configuration of your web server.  With some configurations, all you
need is just a normal user account.  With some other, you need access
to a special CGI account.  If nothing's configured, you'll need root
access to configure it correctly.


For example, on my system, the only privilege I need is my own
account, which allows me to write this file:


---(cookie.cgi)---------------------------------------------------------
#!/usr/local/bin/clisp -q -ansi -norc

(defmacro h (tag-attrs &rest body)
  (let ((tag   (if (consp tag-attrs)
                   (car tag-attrs)
                   tag-attrs ))
        (attrs (if (consp tag-attrs) 
                   (format nil "~:{~A=\"~A\"~^ ~}" (cdr tag-attrs))
                   "")))
    `(unwind-protect
          (progn (format t "~&<~A ~A>" ',tag ',attrs)
                 ,@body)
       (format t "</~A>" ',tag))))

(format t "Content-type: text/html~2%")
(ignore-errors
  (h html
     (h head
        (h title (princ "cookie test cgi")))
     (h (body bgcolor \#4499ff)
        (h h1 (princ "Some environment variables"))
        (h ul
           (h li (format t "REMOTE_HOST = ~A" (ext:getenv "REMOTE_HOST")))
           (h li (format t "REMOTE_ADDR = ~A" (ext:getenv "REMOTE_ADDR")))
           (h li (format t "REMOTE_USER = ~A" (ext:getenv "REMOTE_USER"))))
        (h h1 (princ "A cookie"))
        (h pre
           (ext:shell "/home/pjb/bin/cookie")))))

(ext:exit 0)
------------------------------------------------------------------------

to /usr/local/html/cgi/cookie.cgi
then I can go to http://localhost/cgi/cookie.cgi
to have it run.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

READ THIS BEFORE OPENING PACKAGE: According to certain suggested
versions of the Grand Unified Theory, the primary particles
constituting this product may decay to nothingness within the next
four hundred million years.
From: Tim Johnson
Subject: Re: Deploying as CGI
Date: 
Message-ID: <slrne35sdf.n55.tim@linus.johnson.com>
On 2006-04-04, Pascal Bourguignon <······@informatimago.com> wrote:
> ---(cookie.cgi)---------------------------------------------------------
Aha! No need to compile! Just using the time-honored she-bang and
treating as an interpreted script....

> #!/usr/local/bin/clisp -q -ansi -norc

The 'h macro is a nice demo for rendering html
Thanks. That answers my question right there.
Cheers
Tim


-- 
Tim Johnson <···@johnsons-web.com>
      http://www.alaska-internet-solutions.com
From: Pascal Bourguignon
Subject: Re: Deploying as CGI
Date: 
Message-ID: <877j65dj73.fsf@thalassa.informatimago.com>
Tim Johnson <···@johnsons-web.com> writes:

> On 2006-04-04, Pascal Bourguignon <······@informatimago.com> wrote:
>> ---(cookie.cgi)---------------------------------------------------------
> Aha! No need to compile! Just using the time-honored she-bang and
> treating as an interpreted script....
>
>> #!/usr/local/bin/clisp -q -ansi -norc
>
> The 'h macro is a nice demo for rendering html
> Thanks. That answers my question right there.
> Cheers
> Tim

Well, if your script is complex, it might be worthwhile to compile it:
just add the -C option.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Pour moi, la grande question n'a jamais �t�: �Qui suis-je? O� vais-je?� 
comme l'a formul� si adroitement notre ami Pascal, mais plut�t: 
�Comment vais-je m'en tirer?� -- Jean Yanne
From: Tim Johnson
Subject: Re: Deploying as CGI
Date: 
Message-ID: <slrne361rn.nhm.tim@linus.johnson.com>
On 2006-04-04, Pascal Bourguignon <······@informatimago.com> wrote:
>
> Well, if your script is complex, it might be worthwhile to compile it:
> just add the -C option.

 Are there URLs to further docs on this subject?
 Thanks again.
 tim

-- 
Tim Johnson <···@johnsons-web.com>
      http://www.alaska-internet-solutions.com
From: Pascal Bourguignon
Subject: Re: Deploying as CGI
Date: 
Message-ID: <87zmj0dgrv.fsf@thalassa.informatimago.com>
Tim Johnson <···@johnsons-web.com> writes:

> On 2006-04-04, Pascal Bourguignon <······@informatimago.com> wrote:
>>
>> Well, if your script is complex, it might be worthwhile to compile it:
>> just add the -C option.
>
>  Are there URLs to further docs on this subject?
>  Thanks again.
>  tim

http://clisp.cons.org/
http://clisp.cons.org/impnotes
http://www.google.com/search?q=cgi+protocol

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"This statement is false."            In Lisp: (defun Q () (eq nil (Q)))