silvioprog wrote 14 lines
OK, here is what I did to make your downloaded project work (was not trivial):
1. Unzipped it and moved everything to the same directories
2. Edited the project main .lpr file and changed it to ...<snip>...
uses
fpFCGI, Unit1, iniwebsession {for the error message}, custfcgi {for the poStripContentLength};
begin
Application.Port := 2015; //Port the FCGI application is listening on
Application.ProtocolOptions := Application.ProtocolOptions +
[poStripContentLength];//on windows, without this the response can be
cut short
Application.Initialize;
Application.Run;
end.
...<snip>...
Note, without the iniwebsession we just get an exception complaining about it (this requirement should be removed from fpweb). Also, custfcgi is needed so we can add the protocolotions line, so on Windows the reply is not cut short by Apache (like error messages about the iniwebsession, for example).
3. in the httpd.conf
LoadModule fastcgi_module
"C:/xampp/apache/modules/mod_fastcgi-2.4.6-AP22.dll" <IfModule mod_fastcgi.c>
ScriptAlias /myfcgi "C:/xampp/htdocs/fcgi/test.exe" <Directory "C:/xampp/htdocs/fcgi">
Order allow,deny
Allow from all
</Directory>
FastCgiExternalServer "C:/xampp/htdocs/fcgi/test.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush
4. Start apache
5. Start the test.exe application from a cmd window
6. Navigate to http://127.0.0.1:8080/myfcgi/index from my browser to see: Test
Note, your response generation only sends back the text "Test" instead of a proper web page. It should be at least something like
Handled := True;
AResponse.Content := '<html><body>Test</body></html>';
AB