Clozure Lisp CGI Programming

Discussion of Common Lisp

Re: Clozure Lisp CGI Programming

Postby dmitry_vk » Tue May 12, 2009 4:13 am

To check that you have permission issuses or not, you can run ccl under the www-data user:
Code: Select all
sudo -u www-data /path/to/index.cgi
dmitry_vk
 
Posts: 96
Joined: Sat Jun 28, 2008 8:01 am
Location: Russia, Kazan

Re: Clozure Lisp CGI Programming

Postby Hero Doug » Thu May 14, 2009 1:29 am

To the most recent reply, here are the results of running the app as www-data, it seems as if it's not a permission problem.

doug@doug-desktop:~/software/ccl$ sudo -u www-data /home/doug/dev/trunk/htdocs/index.cgi
[sudo] password for doug:
Content-type: text/html

This is a test


cgsullivan >> The "blank" in the error message you spoke of is filled in if I try to run it "like an interperted script".
[code]#!/home/doug/software/ccl/ccl -I /home/doug/dev/trunk/htdocs/image[/quote]

The error looks like this:
Couldn't load lisp heap image from /home/doug/dev/trunk/htdocs/image
[Fri May 08 10:51:21 2009] [error] [client 127.0.0.1] Premature end of script headers: index.cgi


You're indeed right, the two paths are not the same.
Terminal
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Apache
/usr/local/bin:/usr/bin:/bin


However, the executable should be self contained since I prepended the kernel, I'm not seeing why it needs a path at all.

Anyways, I added the path to apache as you suggested and still had no luck.

I'm going to try saving it without prepending the kernel, maybe I'll be able to load the image by passing it to the CCL binary.



Wodin >> I get how the permissions work; running it as Opera was a brainfart indeed. And I downloaded SBCL from the site, not the repo. I've been using it and it works fine.

I shot an email off to the CCL dev list, I'll see if they can add anything to this.
Hero Doug
 
Posts: 10
Joined: Thu May 07, 2009 4:52 am

Re: Clozure Lisp CGI Programming

Postby John McAleely » Thu May 14, 2009 2:12 am

I note that the error message does not appear to contain the .cgi extension.

What happens if you rename your executable to simply 'image', rather than 'image.cgi'? Perhaps CCL is trying to be a bit clever with an extension it doesn't expect.
John McAleely
 

Re: Clozure Lisp CGI Programming

Postby Hero Doug » Thu May 14, 2009 2:56 am

Ok, I got it working, sort of.

I make an image file and ran it under www-data using a shell script.

Code: Select all
#!/bin/sh

/home/doug/software/ccl/ccl -I /home/doug/dev/trunk/htdocs/sitewire.app


I also prepended the image file to the image and ran that as well using the same method.

Code: Select all
#!/bin/sh

/home/doug/dev/trunk/htdocs/index.cgi


This seems to have fixed the problem, although I never did find out why I had that other problem. At least i can get to work now.
Hero Doug
 
Posts: 10
Joined: Thu May 07, 2009 4:52 am

Re: Clozure Lisp CGI Programming

Postby Hero Doug » Fri May 15, 2009 2:43 am

Now I have the same problems (and more) on my personal computer (I did all that other stuff from my work computer).

I can't save an image with a prepended kernel, and I cant run the image using ANY method.

I've shot an email off the the CCL guys and I'll see what they have to say. I have to say, I'm nearing my wits end.
Hero Doug
 
Posts: 10
Joined: Thu May 07, 2009 4:52 am

Re: Clozure Lisp CGI Programming

Postby Hero Doug » Sat May 16, 2009 5:49 pm

I received an error when trying to save an image with a prepended kernel not long ago. I sent an Email to the Clozure mailing list and it was resolved surprisingly quickly.

[quote=The Error]
:The Error

> Error: value NIL is not of the expected type REAL.
> While executing: CCL::<-2, in process Initial(0).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 >
[/quote]

[quote=The Solution]
Supply the full path to the kernel
(save-application "whatever" :prepend-kernel "/full/path/to/kernel")
[/quote]
Hero Doug
 
Posts: 10
Joined: Thu May 07, 2009 4:52 am

Re: Clozure Lisp CGI Programming

Postby hrapof » Mon May 18, 2009 8:42 am

Funny thing: I'm doing the same right now! CGI isn't very "cool" today, and Lisp isn't supposed to be particularly suited for CGI due to long startup time, and yet there are two persons simultaneously making CGIs with CCL :)
My Clozure CGI works fine with Apache on Windows XP, but fails miserably with IIS (due to some error in CCL-DIRECTORY or USER-HOMEDIR-PATHNAME).
Debugging it, I've noticed that if I call my CCL cgi from C CGI via EXECL, it fails, and SBCL doesn't. The reason is CCL is trying to load its core from the wrong place:

image_name = argv[1];
argv[1] = NULL;
} else {
process_options(argc,argv);
}
initial_stack_size = ensure_stack_limit(initial_stack_size);
if (image_name == NULL) {
if (check_for_embedded_image(argv[0])) {
image_name = argv[0];
} else {
image_name = default_image_name(argv[0]);

But if I use SYSTEM or POPEN, CCL works. So personally I think it's best to call it with a script - start up time shouldn't matter much, if we use Lisp for CGIs, after all ;)
hrapof
 
Posts: 5
Joined: Fri Oct 10, 2008 8:10 am
Location: Moscow, Russia

Re: Clozure Lisp CGI Programming

Postby gugamilare » Mon May 18, 2009 12:40 pm

hrapof wrote:Funny thing: I'm doing the same right now! CGI isn't very "cool" today, and Lisp isn't supposed to be particularly suited for CGI due to long startup time, and yet there are two persons simultaneously making CGIs with CCL :)


If you save your lisp image, startup time (with no init file, of course) is very short.
gugamilare
 
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil

Re: Clozure Lisp CGI Programming

Postby rme » Fri Jul 17, 2009 6:56 pm

hrapof wrote:My Clozure CGI works fine with Apache on Windows XP, but fails miserably with IIS (due to some error in CCL-DIRECTORY or USER-HOMEDIR-PATHNAME).


Some changes to CCL were checked into the trunk several weeks ago to try to address this.

If you're willing, please review http://trac.clozure.com/openmcl/ticket/517 and see if a current trunk still has problems.
rme
 
Posts: 2
Joined: Fri Jul 17, 2009 6:45 pm

Re: Clozure Lisp CGI Programming

Postby szergling » Wed Jul 22, 2009 1:22 am

I'm very late to post, so this is probably all over, but I've seen the "Premature end of script headers" error before programming cgi in clisp, usually because there's a problem somewhere in the #! line (wrong path to lisp, wrong init options, or any other error). Hope this helps...
szergling
 
Posts: 2
Joined: Wed Jul 22, 2009 1:02 am

Previous

Return to Common Lisp

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron