[fpc-pascal] CGI with datamodule does not work

AB fpc-devel at aborka.com
Wed Feb 27 01:42:38 CET 2019


Hi Guys,

I have tried to update my old web project that is in maintenance mode 
since a few years now, using the latest stable Lazarus/FPC, and fcl-web 
just does not want to work (Tried Lazarus 1.8.4/FPC 3.0.4, Lazarus 
2.0.0/FPC 3.0.4 with Apache 2.4, on Linux x86_64, though the OS should 
not matter with fcl-web).

So, after I could not make my original project work with the newer 
fcl-web, I have created a basic Lazarus project: File -> New -> CGI 
Application, and added a default action that just returns a simple html 
page:

procedure Tblahblah.WebDefaultActionRequest(Sender: TObject;
   ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);
begin
   Handled := true;
   AResponse.Content := '<html><body>This function is not implemented 
yet. ' + DateTimeToStr(Now) + '</body></html>';
end;

This one did not work either. Tried in docker with apache-alpine, docker 
with apache, heck, even put it on my live Ubuntu 16.04 with Apache web 
server at the end, with the same result, an error HTML  page from the 
CGI application:
"The application encountered the following error:

     Error: Not found
     Stack trace:
     $0000000000499B40
     $00000000004990EF"

Did anyone test this fcl-web part lately?

BTW, A simple CGI application works OK (File -> New -> Custom CGI 
Application), though there are no Actions, of course:

Procedure TMyCGIHandler.HandleRequest(ARequest : Trequest; AResponse : 
TResponse);

begin
   // Your code here
   AResponse.Content := '<html>Something. (' + ARequest.QueryString + 
')</html>';
end;


Any reproduction or help is appreciated.

AB



More information about the fpc-pascal mailing list