hello,
edit: I thought 1.8 RC4 was broken but I was wrong. with 1.8 RC4, the FPC version is updated to 3.0.4 RC1, in which the fp-web package is updated to support routing.
to enable legacy routing to fix my stupid hello world FCGI applicaiton, add this to the main program.
Application.LegacyRouting:=true;
just to report that mod_fastcgi from mod_fastcgi-2.4.7.1-2.4.x-x64-vc14.zip,
https://www.apachehaus.net/modules/mod_fastcgi/ is working for me, default and custom actions are fine.
both FastCgiServer and FastCgiExternalServer are working, but note that only the external config need the port setup line in the FCGI project
Application.Port:=9999; // For example
The FastCgiExternalServer mode is really good for debugging, and under windows the FCGI exe won't be locked by anyone so you can kill it anytime you like. You can debug, modify the code and build as you wish.
I am using apache 2.4 64 bit, httpd-2.4.27-x64-vc14.zip
this is my apache config
LoadModule fastcgi_module "modules/mod_fastcgi.so"
<IfModule mod_fastcgi.c>
<Directory "C:/checkout/testfcgi/lib/x86_64-win64">
#this two is for 2.2 only
#Order allow,deny
#Allow from all
#this line is needed for 2.4
Require all granted
</Directory>
#regular fast cgi, CGI exe itself is always loaded by apache, non-debuggable, for production
# FastCgiServer "C:/checkout/testfcgi/lib/x86_64-win64/testfcgi.exe" -idle-timeout 30
#external server fast cgi, debuggable, have to start the cgi program manually
FastCgiExternalServer "C:/checkout/testfcgi/lib/x86_64-win64/testfcgi.exe" -host 127.0.0.1:9999 -idle-timeout 30 -flush
ScriptAlias /myfcgi "C:/checkout/testfcgi/lib/x86_64-win64/testfcgi.exe"
</IfModule>
--------------------------------------
and here's my FCGI prrogram's main
begin
Application.Title:='fcgiproject1';
{ Uncomment the port setting here if you want to run the
FastCGI application stand-alone (e.g. for NGINX) }
Application.Port:=9999; // For example
Application.Initialize;
Application.Run;
end.
procedure TFPWebModule1.helloRequest(Sender: TObject; ARequest: TRequest;
AResponse: TResponse; Var Handled: Boolean);
var
i:integer;
begin
AResponse.contents.Add(datetimetostr(now)+' Hello world fast cgi with external server!<br>');
AResponse.contents.Add(ARequest.URL+'<br>');
for i:=0 to ARequest.FieldCount-1 do
begin
AResponse.contents.Add(ARequest.FieldNames
+ ' ' + ARequest.FieldValues+sLineBreak);
end;
Handled:=true;
end;
procedure TFPWebModule1.TFPWebAction0Request(Sender: TObject;
ARequest: TRequest; AResponse: TResponse; Var Handled: Boolean);
var
i:integer;
begin
AResponse.contents.Add(datetimetostr(now)+' default action with external server!<br>');
AResponse.contents.Add(ARequest.URL+'<br>');
for i:=0 to ARequest.FieldCount-1 do
begin
AResponse.contents.Add(ARequest.FieldNames + ' ' + ARequest.FieldValues+sLineBreak);
end;
Handled:=true;
end;
initialization
RegisterHTTPModule('TFPWebModule1', TFPWebModule1);
end.