Prolog.exe as CGI Script
From: Manfred Langhammer (384317480543-0001_at_T-Online.at)
Date: 06/12/04
- Previous message: Nameless: "Re: How to insert a word in a grid"
- Next in thread: Jan Wielemaker: "Re: Prolog.exe as CGI Script"
- Reply: Jan Wielemaker: "Re: Prolog.exe as CGI Script"
- Reply: Martin Sondergaard: "Re: Prolog.exe as CGI Script"
- Reply: Manfred Langhammer: "Re: Prolog.exe as CGI Script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 12 Jun 2004 17:46:25 +0200
Hello,
I try to call a Prolog exe from the CGI. I used exactly an example from the
SWI-Prolog Homepage (http://www.swi-prolog.org/) that can be found in the
documentation of the clib package:
1) Created the following Prolog Source:
:- use_module(library(cgi)).
main :-
cgi_get_form(Arguments),
format('Content-type: text/html~n~n', []),
format('<HTML>~n', []),
format('<HEAD>~n', []),
format('<TITLE>Simple SWI-Prolog CGI script</TITLE>~n', []),
format('</HEAD>~n~n', []),
format('<BODY>~n', []),
format('<P>', []),
print_args(Arguments),
format('<BODY>~n</HTML>~n', []).
print_args([]).
print_args([A0|T]) :-
A0 =.. [Name, Value],
format('<B>~w</B>=<EM>~w</EM><BR>~n', [Name, Value]),
print_args(T).
2) Compiled this source to an exe file:
% pl -o cgidemo --goal=main --toplevel=halt -c cgidemo.pl
3) Put this cgidemo.exe to my cgi-bin directory of my apache server.
4) Called it: http://localhost/cgi-bin/cgidemo.exe?hello=world
The result is 500 - internal server error. In the apache error log I find
the following entry:
Premature end of script headers: cgidemo.exe
I suppose that the prolog programm is not able to send the HTML-Output back
to CGI, but I'm not sure. I followed exactly the steps documented in the
clib package documentation and I have no idea what's going wrong. I searched
the web and the SWI-Prolog Pages for hours without any success.
Perhaps anybody could help me get started with that??
Best regards
Manfred Langhammer
- Previous message: Nameless: "Re: How to insert a word in a grid"
- Next in thread: Jan Wielemaker: "Re: Prolog.exe as CGI Script"
- Reply: Jan Wielemaker: "Re: Prolog.exe as CGI Script"
- Reply: Martin Sondergaard: "Re: Prolog.exe as CGI Script"
- Reply: Manfred Langhammer: "Re: Prolog.exe as CGI Script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|