From: bunnytail
Subject: need help with mod_lisp - apache
Date: 
Message-ID: <417e7617$1@news.cadence.com>
Hi there,

I am currently trying to plug the mod_lisp into apache (1.3).
So far I have compiled mod_lisp.c with apxs and have the mod_lis.so 
binary file.

I've followed the instructions in fractal web page to modified
the httpd.conf file. Now that when I resart apache web server, there are
no obvious complain from the daemon.
The lisp execution area, "/asp", are created and when I point my browser 
to the area, it seems that the area is control by lisp. if I open a lisp
interactive session, load the "mod_lispcmucl.lisp" file and execute the
test command (fetch-mod-lisp-url "localhost" "/asp/fixed").
But the result is a bit confusing, there are some html printed on the 
lines, but saying
"501 Method Not Implemented" ...."url to /index.html not supported."
....blah blah blah...

and however I couldn't seem to have mod_lisp work correctly via browser.
If I understand correctly I should have a lisp session open and load the
"modlisp-cmucl.lisp" file into memory so that lisp can listen to the 
port, 3000 in this case. I've also download the asdf.lisp file and have 
it loaded.  But if i point the browser to the area and type
"debug-table", the function defined in the modlisp-cmucl.lisp, there 
were nothing display in the browser and the soruce is empty.
If I look at the error.log in apache, it says "invalid method in request 
remote-ip-addr".


Can someone tell me what's wrong in my setup?

Do I need to load "asdf.lisp"? Actually what the hell is this for?
If 'asdf.lisp' is not needed, can I also say that "modlisp-cmucl.lisp" 
is also not necessary and its just a utils package?

In the httpd.conf file, we have to put the line
AddModule mod_lisp.c
It's fine for apache to load httpd.conf, but I noticed a line in 
error.log saying mod_lisp.c is not in module list, and cannot be removed 
when I do apache restart. Where should I put this file so that apache 
can sees it?


maybe I didn't include enough information for you to debug my problem. 
Let me know, I will follow up. I didn't include full error log or 
copy/paste the information as the installation was on the other mathine 
that has no email setup.


Thanks in advance,
bunny

From: Edi Weitz
Subject: Re: need help with mod_lisp - apache
Date: 
Message-ID: <usm811esi.fsf@agharta.de>
On Tue, 26 Oct 2004 18:06:46 +0200, bunnytail <······@spam.com> wrote:

> I am currently trying to plug the mod_lisp into apache (1.3).  So
> far I have compiled mod_lisp.c with apxs and have the mod_lis.so
> binary file.

Have you called apxs with the -c -i -a options? This will, as a
result, put mod_lisp.so into the right place and activate it.

> I've followed the instructions in fractal web page to modified the
> httpd.conf file. Now that when I resart apache web server, there are
> no obvious complain from the daemon.  The lisp execution area,
> "/asp", are created and when I point my browser to the area, it
> seems that the area is control by lisp.

Why do you think that?

> if I open a lisp interactive session, load the "mod_lispcmucl.lisp"
> file and execute the test command (fetch-mod-lisp-url "localhost"
> "/asp/fixed").  But the result is a bit confusing, there are some
> html printed on the lines, but saying "501 Method Not Implemented"
> ...."url to /index.html not supported."  ....blah blah blah...

It would be helpful if you could include the full error message here.

> and however I couldn't seem to have mod_lisp work correctly via
> browser.  If I understand correctly I should have a lisp session
> open and load the "modlisp-cmucl.lisp" file into memory so that lisp
> can listen to the port, 3000 in this case. I've also download the
> asdf.lisp file and have it loaded.  But if i point the browser to
> the area and type "debug-table", the function defined in the
> modlisp-cmucl.lisp, there were nothing display in the browser and
> the soruce is empty.  If I look at the error.log in apache, it says
> "invalid method in request remote-ip-addr".
>
> Can someone tell me what's wrong in my setup?

I can only guess that you've messed up with the ports. Looks like
Apache somehow sees the traffic between mod_lisp and Lisp and
interprets it as a HTTP request.

> Do I need to load "asdf.lisp"? Actually what the hell is this for?

No, you don't need it for this simple setup. It's a system definition
utility used to load larger systems. Think of it as a kind of 'make.'

> If 'asdf.lisp' is not needed, can I also say that
> "modlisp-cmucl.lisp" is also not necessary and its just a utils
> package?

Well, you'll need /something/ on the Lisp side. mod_lisp works like
this: Whenever a HTTP request is sent to Apache (requesting an URL
mod_lisp is set up for) mod_lisp sends this information to an external
Lisp process via the port (3000 by default) that you've
specified. There /must/ be some process (Lisp or otherwise) listening
on port 3000 which knows what to do with this data. In particular, it
has to send a reply back to the Apache child that sent the data
initially. This reply will be used to send a response to the browser.

> In the httpd.conf file, we have to put the line AddModule mod_lisp.c
> It's fine for apache to load httpd.conf, but I noticed a line in
> error.log saying mod_lisp.c is not in module list, and cannot be
> removed when I do apache restart. Where should I put this file so
> that apache can sees it?

See the apxs options above.

> maybe I didn't include enough information for you to debug my
> problem. Let me know, I will follow up. I didn't include full error
> log or copy/paste the information as the installation was on the
> other mathine that has no email setup.

I'd suggest that you subscribe to the mod_lisp mailing list and ask
further questions there.

  <http://common-lisp.net/mailman/listinfo/mod-lisp-devel>

You might also want to look at TBNL which is based on mod_lisp. To
install TBNL you'll need to be familiar with ASDF but even if you
don't install it the documentation might be helpful.

  <http://weitz.de/tbnl/>

HTH,
Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: bunny
Subject: Re: need help with mod_lisp - apache
Date: 
Message-ID: <417f7201$1@news.cadence.com>
Thanks for your reply Edi, here is the cut&paste that I sent to the 
mod_lisp email alias. Still fighting to get it to work.





I've some difficulty in setting up mod_lisp in apache. Hope someone out 
there can shede some light on this.

I've compiled mod_lisp.c:

[····@lnx-mucvcadpool2 httpd-1-3-31]# ll
total 116
drwxr-xr-x    2 root     root         4096 Oct 27 11:21 bin
drwxr-xr-x    2 root     root         4096 Oct 25 17:49 cgi-bin
drwxr-xr-x    2 root     root         4096 Oct 27 11:22 conf
drwxr-xr-x    3 root     root         4096 Oct 25 17:49 htdocs
drwxr-xr-x    3 root     root         4096 Oct 25 17:49 icons
drwxr-xr-x    3 root     root         4096 Oct 26 17:21 
includedrwxr-xr-x    2 root     root         4096 Oct 27 11:21 
libexecdrwxr-xr-x    2 root     root         4096 Oct 26 17:22 
logsdrwxr-xr-x    4 root     root         4096 Oct 25 17:48 
man-rw-r--r--    1 root     root        49217 Oct 26 17:15 
mod_lisp.cdrwxr-xr-x    2 nobody   nobody       4096 Oct 25 17:49

proxy[····@lnx-mucvcadpool2 httpd-1-3-31]#

[····@lnx-mucvcadpool2 bin]# ./apxs -a -i -c ../mod_lisp.cgcc -DLINUX=22 
-DHAVE_SET_DUMPABLE -DUSE_HSREGEX -fpic -DSHARED_MODULE 
-I/home2/software/httpd-1-3-31/include  -c ../mod_lisp.cgcc -shared -o 
../mod_lisp.so mod_lisp.o[activating module `lisp' in 
/home2/software/httpd-1-3-31/conf/httpd.conf]cp ../mod_lisp.so 
/home2/software/httpd-1-3-31/libexec/mod_lisp.sochmod 755 
/home2/software/httpd-1-3-31/libexec/mod_lisp.socp 
/home2/software/httpd-1-3-31/conf/httpd.conf 
/home2/software/httpd-1-3-31/conf/httpd.conf.bakcp 
/home2/software/httpd-1-3-31/conf/httpd.conf.new 
/home2/software/httpd-1-3-31/conf/httpd.confrm 
/home2/software/httpd-1-3-31/conf/httpd.conf.new


Modified the httpd.conf file:

.....<snip> ....
LoadModule setenvif_module    libexec/mod_setenvif.so
LoadModule lisp_module        libexec/mod_lisp.so...

ClearModuleList...
AddModule mod_lisp.c

# Setup lisp dir for lisp code to be handled by LISP
LispServer  127.0.0.1 3000 "fractal"
<Location /asp>
SetHandler lisp-handler
</Location>    	

Alias /asp/ "/home2/software/asp/"    	
<Directory "/home2/software/asp">		
Options None		
AllowOverride None		
Order allow,deny        	
Allow from all   	
</Directory>

The server seems not happy with the port setting 3000, or its not 
listening to 3000:

* (fetch-mod-lisp-url "localhost" "/asp/fixed")

Error in function CONNECT-TO-INET-SOCKET:   Error connecting socket to 
[localhost:3000]: Connection refused
[Condition of type SIMPLE-ERROR] Restarts:
0: [ABORT] Return to Top-Level.
Debug  (type H for help)
(CONNECT-TO-INET-SOCKET "localhost" 3000 :STREAM)
Source: Error finding source:Error in function 
DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer exists: 
target:code/internet.lisp.
0] 0

So I added this to httpd.conf:	Listen 3000

restart and run the test function again:

* (fetch-mod-lisp-url "localhost" "/asp/fixed")
(("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" . 
"<HTML><HEAD>") ("<TITLE>501 Method Not Implemented</TITLE>" . 
"</HEAD><BODY>") ("<H1>Method Not Implemented</H1>" . "url to 
/index.html not supported.<P>")
("Invalid method in request url<P>" . "<HR>")
("<ADDRESS>Apache/1.3.31 Server at lnx-mucvcadpool2 Port 8000</ADDRESS>" 
  . "</BODY></HTML>"))

So I assume the server is openning the port and lisp is listening to 
this port, am I right?
But as you can see, " ...Method Not Implemented...", in the returned 
text. Something must be wrong.
Oh, of cause I have already open a lisp session in terminal and load the 
cmucl lisp file:	
(load "/home2/software/asp/modlisp-cmucl.lisp")

Now the problem is if I point my browser to the area that lisp suppose 
to handle:
http://127.0.0.1:8000/asp/debug-table

As I understand debug-talbe is a predefined function in 
modlisp-cmucl.lisp, so something should happen.

However, I received nothing in the browser, empty screen and empty 
source file. Look at the apache log file:

In access.log:	
127.0.0.1 - - [27/Oct/2004:11:43:46 +0200] 	"remote-ip-addr" 501 - 
127.0.0.1 - - [27/Oct/2004:11:43:46 +0200] "GET 	/asp/debug-table 
HTTP/1.1" 200 5

In error.log:

[Wed Oct 27 11:34:10 2004] [notice] SIGHUP received.  Attempting to restart
[Wed Oct 27 11:34:10 2004] [error] Cannot remove module mod_lisp.c: not 
found in module list
[Wed Oct 27 11:34:10 2004] [notice] Apache/1.3.31 (Unix) mod_lisp/2.35 
configured -- resuming normal operations
[Wed Oct 27 11:34:10 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Wed Oct 27 11:34:14 2004] [error] [client 127.0.0.1] Invalid method in 
request url
[Wed Oct 27 11:43:46 2004] [error] [client 127.0.0.1] Invalid method in 
request remote-ip-addr

Note the mod_lis.c is not found in module list. Where should I put it?

First invalid method in request url is generated from this function call 
in lisp session:	
(fetch-mod-lisp-url "localhost" "/asp/fixed")
the second "invalid mthod in request remote-ip-addr" is from the 
broswser request for "debug-table".

It seems to me something is still wrong. Maybe someone can point it out?

Many thanks,
bunny



Edi Weitz wrote:
> On Tue, 26 Oct 2004 18:06:46 +0200, bunnytail <······@spam.com> wrote:
> 
> 
>>I am currently trying to plug the mod_lisp into apache (1.3).  So
>>far I have compiled mod_lisp.c with apxs and have the mod_lis.so
>>binary file.
> 
> 
> Have you called apxs with the -c -i -a options? This will, as a
> result, put mod_lisp.so into the right place and activate it.
> 
> 
>>I've followed the instructions in fractal web page to modified the
>>httpd.conf file. Now that when I resart apache web server, there are
>>no obvious complain from the daemon.  The lisp execution area,
>>"/asp", are created and when I point my browser to the area, it
>>seems that the area is control by lisp.
> 
> 
> Why do you think that?
> 
> 
>>if I open a lisp interactive session, load the "mod_lispcmucl.lisp"
>>file and execute the test command (fetch-mod-lisp-url "localhost"
>>"/asp/fixed").  But the result is a bit confusing, there are some
>>html printed on the lines, but saying "501 Method Not Implemented"
>>...."url to /index.html not supported."  ....blah blah blah...
> 
> 
> It would be helpful if you could include the full error message here.
> 
> 
>>and however I couldn't seem to have mod_lisp work correctly via
>>browser.  If I understand correctly I should have a lisp session
>>open and load the "modlisp-cmucl.lisp" file into memory so that lisp
>>can listen to the port, 3000 in this case. I've also download the
>>asdf.lisp file and have it loaded.  But if i point the browser to
>>the area and type "debug-table", the function defined in the
>>modlisp-cmucl.lisp, there were nothing display in the browser and
>>the soruce is empty.  If I look at the error.log in apache, it says
>>"invalid method in request remote-ip-addr".
>>
>>Can someone tell me what's wrong in my setup?
> 
> 
> I can only guess that you've messed up with the ports. Looks like
> Apache somehow sees the traffic between mod_lisp and Lisp and
> interprets it as a HTTP request.
> 
> 
>>Do I need to load "asdf.lisp"? Actually what the hell is this for?
> 
> 
> No, you don't need it for this simple setup. It's a system definition
> utility used to load larger systems. Think of it as a kind of 'make.'
> 
> 
>>If 'asdf.lisp' is not needed, can I also say that
>>"modlisp-cmucl.lisp" is also not necessary and its just a utils
>>package?
> 
> 
> Well, you'll need /something/ on the Lisp side. mod_lisp works like
> this: Whenever a HTTP request is sent to Apache (requesting an URL
> mod_lisp is set up for) mod_lisp sends this information to an external
> Lisp process via the port (3000 by default) that you've
> specified. There /must/ be some process (Lisp or otherwise) listening
> on port 3000 which knows what to do with this data. In particular, it
> has to send a reply back to the Apache child that sent the data
> initially. This reply will be used to send a response to the browser.
> 
> 
>>In the httpd.conf file, we have to put the line AddModule mod_lisp.c
>>It's fine for apache to load httpd.conf, but I noticed a line in
>>error.log saying mod_lisp.c is not in module list, and cannot be
>>removed when I do apache restart. Where should I put this file so
>>that apache can sees it?
> 
> 
> See the apxs options above.
> 
> 
>>maybe I didn't include enough information for you to debug my
>>problem. Let me know, I will follow up. I didn't include full error
>>log or copy/paste the information as the installation was on the
>>other mathine that has no email setup.
> 
> 
> I'd suggest that you subscribe to the mod_lisp mailing list and ask
> further questions there.
> 
>   <http://common-lisp.net/mailman/listinfo/mod-lisp-devel>
> 
> You might also want to look at TBNL which is based on mod_lisp. To
> install TBNL you'll need to be familiar with ASDF but even if you
> don't install it the documentation might be helpful.
> 
>   <http://weitz.de/tbnl/>
> 
> HTH,
> Edi.
> 
From: Ng Pheng Siong
Subject: Re: need help with mod_lisp - apache
Date: 
Message-ID: <clofl3$mnm$1@reader01.singnet.com.sg>
According to bunny  <····@spam.com>:
> LoadModule setenvif_module    libexec/mod_setenvif.so
> LoadModule lisp_module        libexec/mod_lisp.so...
> 
> ClearModuleList...
> AddModule mod_lisp.c

ISTR that these two lists should be in the same order, i.e., since you have
"AddModule mod_lisp.c" right after "ClearModuleList", "LoadModule
lisp_module ..." must go right at the top, before mmap_static_module and
not at the end after setenvif_module.

> # Setup lisp dir for lisp code to be handled by LISP
> LispServer  127.0.0.1 3000 "fractal"
> <Location /asp>
> SetHandler lisp-handler
> </Location>    	
> 
> Alias /asp/ "/home2/software/asp/"    	
> <Directory "/home2/software/asp">		
> Options None		
> AllowOverride None		
> Order allow,deny        	
> Allow from all   	
> </Directory>

The "Alias" is wrong - first you say let location "/asp" be handled by
mod_lisp, next you say use the filesystem. Drop the alias and the
"directory" chunk after it.

> The server seems not happy with the port setting 3000, or its not 
> listening to 3000:

The Lisp process is the one to be listening on port 3000, not Apache.

> So I added this to httpd.conf:	Listen 3000
> [...]
> So I assume the server is openning the port and lisp is listening to 
> this port, am I right?

Nope. You asked Apache to listen to the port.

Let's look at (an excerpt of) modlisp-cmucl.lisp:

  ;; modlisp-cmucl.lisp
  ;; original mod-lisp.lisp author ·············@fractalconcept.com
  ;; ported to cmucl by ···@mail.com
  
  (defconstant +apache-port+ 3000)
  ; other stuff deleted
  
  (defun make-apache-listener (port)
    ...)
  
  (defun start-apache-listener ()
    (mp:make-process #'(lambda () (make-apache-listener +apache-port+))))

When you LOAD this file into your Lisp process, its network server isn't
started automatically. To start it, evaluate (START-APACHE-LISTENER) at the
REPL. 

Then point your browser at "http://whatever/asp/". Your browser talks
to Apache at Apache's port 80. Apache talks to your Lisp process at the
latter's port 3000.

HTH.
-- 
Ng Pheng Siong <····@netmemetic.com> 
http://sandbox.rulemaker.net/ngps -+- M2Crypto, ZServerSSL for Zope, Blog
From: bunnytail
Subject: Re: need help with mod_lisp - apache
Date: 
Message-ID: <4180be12@news.cadence.com>
Thanks Ng, it works now. Very nice explaination.

Cheers,
bunny



Ng Pheng Siong wrote:

........

> When you LOAD this file into your Lisp process, its network server isn't
> started automatically. To start it, evaluate (START-APACHE-LISTENER) at the
> REPL. 
> 
> Then point your browser at "http://whatever/asp/". Your browser talks
> to Apache at Apache's port 80. Apache talks to your Lisp process at the
> latter's port 3000.
> 
> HTH.