From: Venkat
Subject: Lisp in php
Date: 
Message-ID: <df17b249.0309111415.12dd2c1d@posting.google.com>
Hi,

I have some lisp code and I am trying to create a web interface 
to it using php. 
Right now I am executing the lisp code from command line,
formatting the output and displaying them as html.

But the problem is,
Every time I execute, I have to load lisp and kill it. It is taking
quite some time in doing so. Is there any way to start lisp command
interface in background (once when the first request from html comes)
and continue to execute to the remaining http requests(that involve
lisp commands) by sending some sort of commands.

I am using Allegro lisp and Allegro serve is not suitable for me.

Thanks in advance.
venkat.

From: Larry Clapp
Subject: Re: Lisp in php
Date: 
Message-ID: <slrnbm27n1.2bj.larry@theclapp.ddts.net>
In article <····························@posting.google.com>, Venkat wrote:
> I have some lisp code and I am trying to create a web interface 
> to it using php. 
> Right now I am executing the lisp code from command line,
> formatting the output and displaying them as html.
> 
> But the problem is,
> Every time I execute, I have to load lisp and kill it. It is taking
> quite some time in doing so. Is there any way to start lisp command
> interface in background (once when the first request from html
> comes) and continue to execute to the remaining http requests(that
> involve lisp commands) by sending some sort of commands.

I've had good luck with Apache + mod_lisp + cl-modlisp.

http://www.apache.org
http://www.fractalconcept.com/asp/hDt/sdataQGc9cuW0M0EtDM==/asdataQuvY9x3g$ecX
http://cl-modlisp.b9.com/readme.html

I don't know much about php other than the vague impression that it
more-or-less embeds Perl into html.  If this is more-or-less true, and
you'd rather use Lisp, consider LML2 (http://lml2.b9.com/readme.html).

If you use Debian GNU/Linux, packages exist (possibly only in
"testing" or "unstable") for all of these.

-- 
Larry Clapp / ·····@theclapp.org
Use Lisp from Vim: VILisp: http://vim.sourceforge.net/script.php?script_id=221
From: Gisle Sælensminde
Subject: Re: Lisp in php
Date: 
Message-ID: <slrnbm2qed.5lr.gisle@ginkgo.ii.uib.no>
In article <····························@posting.google.com>, Venkat wrote:
> Hi,
> 
> I have some lisp code and I am trying to create a web interface 
> to it using php. 
> Right now I am executing the lisp code from command line,
> formatting the output and displaying them as html.
> 
> But the problem is,
> Every time I execute, I have to load lisp and kill it. It is taking
> quite some time in doing so. Is there any way to start lisp command
> interface in background (once when the first request from html comes)
> and continue to execute to the remaining http requests(that involve
> lisp commands) by sending some sort of commands.
> 
> I am using Allegro lisp and Allegro serve is not suitable for me.

In the lisp tradition it has been unusual to start up a new lisp process
for each time something is to be done, so solutions like aserve and mod_lisp
is often considered a more lispy way of doing web scripts. It is not the
only way however, since clisp is about as fast to start up as PHP, Perl
and Python, and can be used in the same way as those languages. 

--
Gisle S�lensminde
Computational biology unit, University of Bergen, Norway
Email: ·····@cbu.uib.no
From: Rene van Bevern
Subject: Re: Lisp in php
Date: 
Message-ID: <slrnbm2rh4.bn.rvb@negoyl.vb-network>
On 12 Sep 2003 06:38:06 GMT, Gisle S�lensminde <·····@ginkgo.ii.uib.no> wrote:

hi

> In the lisp tradition it has been unusual to start up a new lisp process
> for each time something is to be done, so solutions like aserve and mod_lisp
> is often considered a more lispy way of doing web scripts. It is not the
> only way however, since clisp is about as fast to start up as PHP, Perl
> and Python, and can be used in the same way as those languages. 

is there also a way to embed LISP in HTML pages, as with PHP or Ruby?

	Rene
From: Edi Weitz
Subject: Re: Lisp in php
Date: 
Message-ID: <87ekymv4m0.fsf@bird.agharta.de>
On Fri, 12 Sep 2003 09:03:02 +0200, Rene van Bevern <···@rvb.dyndns.org> wrote:

> is there also a way to embed LISP in HTML pages, as with PHP or
> Ruby?

From its name and description it looks like ALP might me what you're
looking for - see <http://www.cliki.net/ALP>. There's no code on the
ALP home page but I once talked to the author and he said he has plans
to publish it. Ask him.

Shameless self-plug: There's also the possibility to use a
template-based approach with Lisp, i.e. you don't embed Lisp into HTML
but rather placeholders. See <http://weitz.de/html-template/>.

Edi.
From: Gisle Sælensminde
Subject: Re: Lisp in php
Date: 
Message-ID: <slrnbm3e3f.7hs.gisle@ginkgo.ii.uib.no>
In article <·················@negoyl.vb-network>, Rene van Bevern wrote:
> On 12 Sep 2003 06:38:06 GMT, Gisle S�lensminde <·····@ginkgo.ii.uib.no> wrote:
> 
> hi
> 
>> In the lisp tradition it has been unusual to start up a new lisp process
>> for each time something is to be done, so solutions like aserve and mod_lisp
>> is often considered a more lispy way of doing web scripts. It is not the
>> only way however, since clisp is about as fast to start up as PHP, Perl
>> and Python, and can be used in the same way as those languages. 
> 
> is there also a way to embed LISP in HTML pages, as with PHP or Ruby?
> 
> 	Rene

In another answer Edi Weitz gave you a link on this, but one comment.
In addition to the fact that the package seemed quite imature, I would
say that it is generally a bad idea to include HTML code directly in 
the sourcecode. It makes the code less readable, and it is harder to
change the web design later, since you have embedded it in your code.

It also makes it harder to cooperate with web designers, since they use
graphical tools that often don't understand the embedded code in the
scripts, and they can't just send you the next version of the web design.
It is usually better to use some kind of page templates instead.


-- 
--
Gisle S�lensminde
Computational biology unit, University of Bergen, Norway
Email: ·····@cbu.uib.no
From: Espen Vestre
Subject: Re: Lisp in php
Date: 
Message-ID: <kwad9ah1zj.fsf@merced.netfonds.no>
··················@yahoo.com (Venkat) writes:

> But the problem is,
> Every time I execute, I have to load lisp and kill it. It is taking
> quite some time in doing so. Is there any way to start lisp command
> interface in background (once when the first request from html comes)
> and continue to execute to the remaining http requests(that involve
> lisp commands) by sending some sort of commands.

Sure. If you don't want to go for modlisp like suggested, you could
make a tcp server out of your lisp program and have PHP connect to
it. Remember to take appropriate security considerations (handle
user input with care, set *read-eval* to nil in the lisp server).
-- 
  (espen)
From: Thomas F. Burdick
Subject: Re: Lisp in php
Date: 
Message-ID: <xcvsmn1fto8.fsf@famine.OCF.Berkeley.EDU>
··················@yahoo.com (Venkat) writes:

> I have some lisp code and I am trying to create a web interface 
> to it using php. 
> Right now I am executing the lisp code from command line,
> formatting the output and displaying them as html.
> 
> But the problem is,
> Every time I execute, I have to load lisp and kill it. It is taking
> quite some time in doing so. Is there any way to start lisp command
> interface in background (once when the first request from html comes)
> and continue to execute to the remaining http requests(that involve
> lisp commands) by sending some sort of commands.

Yes, this is a perfectly viable option.  I use a small Perl script
that does this -- it checks to see if the Lisp process is running, if
not, its forks off a detatched screen session that starts up the Lisp
process -- then it sends its stdin to the Lisp process and cats the
Lisp process's response to its stdout.  I use a PID log file to tell
if the Lisp is running, and communicate over a UNIX socket.  It's not
optimal, but it is a workable strategy to integrate a Lisp service
into a more normal Unix/CGI setup.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Rob Warnock
Subject: Re: Lisp in php
Date: 
Message-ID: <j76dnbKFr_JZYv-iXTWc-g@speakeasy.net>
Thomas F. Burdick <···@famine.OCF.Berkeley.EDU> wrote:
+---------------
| ··················@yahoo.com (Venkat) writes:
| > Every time I execute, I have to load lisp and kill it. It is taking
| > quite some time in doing so. Is there any way to start lisp command
| > interface in background (once when the first request from html comes)
| > and continue to execute to the remaining http requests(that involve
| > lisp commands) by sending some sort of commands.
| 
| Yes, this is a perfectly viable option.  I use a small Perl script
| that does this -- it checks to see if the Lisp process is running, if
| not, its forks off a detatched screen session that starts up the Lisp
| process -- then it sends its stdin to the Lisp process and cats the
| Lisp process's response to its stdout.  I use a PID log file to tell
| if the Lisp is running, and communicate over a UNIX socket.
+---------------

I do a similar thing, with a tiny C-coded program that (almost) mimics
the "mod_lisp" protocol. (That is, it passes all the CGI environment
variables before doing the stdin/stdout "over the shoulder" passing.)

+---------------
| It's not optimal, but it is a workable strategy to integrate a Lisp
| service into a more normal Unix/CGI setup.
+---------------

I agree. On a 1.4 GHz Athlon, I can get 70-85 web requests/second
through Apache, the C-code CGI trampoline, and into/out_of the Lisp
server for small interpreted pages, and ~100 requests/second for
small compiled pages. This is plenty fast for the apps that I'm
interested in (which have actual hits rates much less than one/sec).

Later, if still more performance is needed, the CGI trampoline could be
replaced with "mod_lisp", with (almost) no changes in the Lisp server.


-Rob

-----
Rob Warnock, PP-ASEL-IA		<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Jon S. Anthony
Subject: Re: Lisp in php
Date: 
Message-ID: <m3r82klnz1.fsf@rigel.goldenthreadtech.com>
···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> I use a small Perl script that does this -- it checks to see if the
> Lisp process is running, if not, its forks off a detatched screen
> session that starts up the Lisp process -- then it sends its stdin
> to the Lisp process and cats the Lisp process's response to its
> stdout.  I use a PID log file to tell if the Lisp is running, and
> communicate over a UNIX socket.  It's not optimal, but it is a
> workable strategy to integrate a Lisp service into a more normal
> Unix/CGI setup.

Why not just use FastCGI (www.FastCGI.com).  Works great and will work
with a variety of Web servers.  There are a couple CL modules
available (at the site) and really, if you don't like them it only
takes a couple hundred lines or so of code to make your own version.

/Jon
From: Thomas F. Burdick
Subject: Re: Lisp in php
Date: 
Message-ID: <xcvbrtnyqwu.fsf@apocalypse.OCF.Berkeley.EDU>
·········@rcn.com (Jon S. Anthony) writes:

> ···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> 
> > I use a small Perl script that does this -- it checks to see if the
> > Lisp process is running, if not, its forks off a detatched screen
> > session that starts up the Lisp process -- then it sends its stdin
> > to the Lisp process and cats the Lisp process's response to its
> > stdout.  I use a PID log file to tell if the Lisp is running, and
> > communicate over a UNIX socket.  It's not optimal, but it is a
> > workable strategy to integrate a Lisp service into a more normal
> > Unix/CGI setup.
> 
> Why not just use FastCGI (www.FastCGI.com).  Works great and will work
> with a variety of Web servers.  There are a couple CL modules
> available (at the site) and really, if you don't like them it only
> takes a couple hundred lines or so of code to make your own version.

Because that's now what I'm doing.  There's a Perl CGI script, but I
want to be able to write the hard stuff in Lisp.  So, there's a little
Lisp servlet which takes in requests (*not* CGI requests, just data
in), and spits out its output.  The little shim just makes it easy to
access from a Unix pipeline.

(Although, for something as simple as FastCGI, I'd probably just
reinvent it myself.  In a productive language like Lisp, it hardly
seems worth the effort to learn and install and configure something
like FastCGI).

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Thomas F. Burdick
Subject: Re: Lisp in php
Date: 
Message-ID: <xcvy8wqrbpm.fsf@apocalypse.OCF.Berkeley.EDU>
···@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> ·········@rcn.com (Jon S. Anthony) writes:
> 
> > ···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> > 
> > > I use a small Perl script that does this -- it checks to see if the
> > > Lisp process is running, if not, its forks off a detatched screen
> > > session that starts up the Lisp process -- then it sends its stdin
> > > to the Lisp process and cats the Lisp process's response to its
> > > stdout.  I use a PID log file to tell if the Lisp is running, and
> > > communicate over a UNIX socket.  It's not optimal, but it is a
> > > workable strategy to integrate a Lisp service into a more normal
> > > Unix/CGI setup.
> > 
> > Why not just use FastCGI (www.FastCGI.com).  Works great and will work
> > with a variety of Web servers.  There are a couple CL modules
> > available (at the site) and really, if you don't like them it only
> > takes a couple hundred lines or so of code to make your own version.
> 
> Because that's now what I'm doing.

Ug, that was supposed to say "that's not what I'm doing."

  There's a Perl CGI script, but I
> want to be able to write the hard stuff in Lisp.  So, there's a little
> Lisp servlet which takes in requests (*not* CGI requests, just data
> in), and spits out its output.  The little shim just makes it easy to
> access from a Unix pipeline.
> 
> (Although, for something as simple as FastCGI, I'd probably just
> reinvent it myself.  In a productive language like Lisp, it hardly
> seems worth the effort to learn and install and configure something
> like FastCGI).
> 
> -- 
>            /|_     .-----------------------.                        
>          ,'  .\  / | No to Imperialist war |                        
>      ,--'    _,'   | Wage class war!       |                        
>     /       /      `-----------------------'                        
>    (   -.  |                               
>    |     ) |                               
>   (`-.  '--.)                              
>    `. )----'                               

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Jon S. Anthony
Subject: Re: Lisp in php
Date: 
Message-ID: <m3isnrletl.fsf@rigel.goldenthreadtech.com>
···@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> ·········@rcn.com (Jon S. Anthony) writes:
> 
> > Why not just use FastCGI (www.FastCGI.com).  Works great and will work
> > with a variety of Web servers.  There are a couple CL modules
> > available (at the site) and really, if you don't like them it only
> > takes a couple hundred lines or so of code to make your own version.
> 
> Because that's now what I'm doing.  There's a Perl CGI script, but I
> want to be able to write the hard stuff in Lisp.  So, there's a little
> Lisp servlet which takes in requests (*not* CGI requests, just data
> in), and spits out its output.  The little shim just makes it easy to
> access from a Unix pipeline.

The difference, of course, is that you get rid of the Perl jump - or
any other startup costs.  The Lisp server just stays there waiting for
input.

> (Although, for something as simple as FastCGI, I'd probably just
> reinvent it myself.  In a productive language like Lisp, it hardly
> seems worth the effort to learn and install and configure something
> like FastCGI).

Whatever floats your boat.  But getting and installin FastCGI is
trivial.  Also, "reinventing" FastCGI in CL would require a CL Web
server.  That's fine, but if you need something else (customer
demands...) like Apache, IIS, IPlanet or what have you, you need to
hack it up in C (or somesuch).  But then that's exactly what FastCGI
_is_ already.


/Jon