newlisp plus php

For the Compleat Fan
Locked
tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

newlisp plus php

Post by tom »

Hi Guys,

I wonder if it's possible for something like my fantastic illustration to be
implemented. It would be handy to be able to run "real" web apps, like
blogs, forums, and wikis in, say, php, wrapped in newlisp. php could do
it's job and newlisp could handle the presentation or other things.

Image
The webserver I would probably use is lighttpd with php/fastcgi. If I
understand correctly the newlisp process running as a regular cgi would not
be able to keep up with (some lamp app) as a fastcgi.

Am I dreaming or is this possible? I'm pretty sure that the php I use with
lighttpd has to have fastcgi capabilities compiled in. In order to work
like I'm hoping, would newlisp too? I don't mean to make this yet another
fascgi post, by the way. fcgi just seems to be "the" way to do it.

unixtechie
Posts: 65
Joined: Sat Sep 06, 2008 6:30 am

????

Post by unixtechie »

I do not see any meaning in this scheme. It possibly appeared as a sort of shortcut: there are a lot of web apps in PHP, let's reuse them. But what exactly role lisp add-ons should play?

Techincally the answer to your question is twofold.
FIRST, newlisp lives well as a language for web apps. It can be used under CGI, or, if one wishes to have a persistent application, one can run it under a generic apache module, which is equivalent to FastCGI, but uses ASCII based protocol for exchanges, what makes scripting for it elementary. Make a search in this forum for all postings by "lithper" and see his mini-HOWTO about running apache with mod_lisp (this is the generic ASCII-based FastCGI equivalent).

Moreover, newlisp contains a small webserver that is BUILT-IN, i.e. for lower-load web apps you can simply run your script in the web server mode. High loads will crash the server, though, so you might want to restart it from inetd or use a more robust apache if your loads come to that level.

There are examples of scripting for web apps on the main newlisp site (a wiki, an IDE with a web interface etc.)

THE SECOND PART OF THE ANSWER is that newlisp is also a LIBRARY, and so it can be used FROM INSIDE many languages. Check the docs on using PHP with external libraries.

But, generally speaking, I do not see a good reason for the arrangement you have suggested. My years of work with all kinds of users taught me one thing: demand a concrete example, refuse to speak in generic or abstract terms, and try to see what problem the user tries to solve rather than act on his own conclusions of what needs to be done.
Give an example of what you mean by "and newlisp could handle the presentation or other things" - what presentation? of what things? "Other" as different from what?

tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

Post by tom »

Let me say this another way. cgi.lsp provides "CGI:put-page", which inserts
the contents of another file somewhere in your newlisp cgi page. My
question is can you do this not with some file but with, for instance, a
wordpress blog.

Maybe all I want is for newlisp to say,

Hello!

on the top of each page.

Can it?

If you are a stickler for details you can replace "LAMP" in my
drawing with "LLMP" or LNMP", since I will be using either lighttpd or
nginx, not apache.

tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

Post by tom »

I'm sorry, I guess this is yet another fastcgi thread.
http://fastcgi.coremail.cn/ wrote: To enable FastCGI, You can configure PHP with --enable-fastcgi and recompile PHP
replace the word "PHP" with "newlisp". yes? no? possible? necessary?

unixtechie
Posts: 65
Joined: Sat Sep 06, 2008 6:30 am

Post by unixtechie »

1. Something like FastCGI: see this posting:

Fast web serving and mod_lisp mini-HOWTO
http://www.alh.net/newlisp/phpbb/viewtopic.php?t=2197

It's unnecessarily detailed, but the setup is simple:
(a) run mod_lisp under apache (i.e. add it and minimally configure to find the newlisp server)
(b) run newlisp in server mode and
(c) script to parse the easiest possible nano-protocol of mod_lisp, which is basically HTML plus a few symbols, all in ASCII

Your script can be bundled with the newlisp executable to create 230k+your.script.size roughly, and then you hust start it as an application for apache to talk to.


2. You can always insert another file in "iframes", you can always download/fetch any HTML and page attributes with built-in operators inside newlisp, and then reprint them as part of your output for the page you are trying to create.

Usuallty, however, you would not like to retranslate a whole HTML page with all its styles, and would prefer to reprocess whatever you have fetched. It can be done with built-in operators to parse some standard XML fields out of the stream, or you can process the page by matching arbitrary elements with built-in operators, as I did in my scripts.

Locked