* * *

Author Topic: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux  (Read 62282 times)

bobo

  • Full Member
  • ***
  • Posts: 171
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #15 on: November 22, 2012, 09:34:19 am »
Quote
"so this version might not work with Apache 2.4.1 - does anyone know of a verison that does or have I missed something?"

mod_fastcgi does not seem to support Apache 2.4.X , the maintenance is totally stopped on the project it seems.
However, Apache 2.4.X has a new way to do the same functionality now, to do external FCGI server (FastCgiExternalServer) via the new mod_proxy_fcgi module.
I will update the top post once it is figured out how to make it work with fpc/lazarus , and the SVN is updated for fpc as needed to support it. Most probably this new way will be the preferred FCGI external server functionality instead of the old third party mod_fastcgi .

mod_fcgid still works as before, so we still have a perfectly working FCGI way with the latest Apache.
Both mod_fcgid and mod_proxy_fcgi are included in Apache from 2.3.X .

BTW, mod_fcgid is not for real time debugging (unless you are using log files) because in this case Apache loads the FCGI application at startup so there is no way to use a debugger like with the mod_fastcgi method (or with the new mod_proxy_fcgi module).
The  two latter you need to start the FCGI app yourself, hence you can use a debugger to execute them.
Compared to the debugging benefits of the two latter ones, mod_fcgid instead might be a good way for live web servers though, because Apache can start the FCGI app instances as needed, automatically.

Quote
"The bit I struggled with was that the demos have the listening "port" set to 2015 in the application source (the lpr file) - once you comment this out it seems to work fine with this setup - both applications are launched the first time they are called from the browser and remain in memory for each subsequent request."
The port is only used for the mod_fastcgi  FastCgiExternalServer mode (and the new Apache 2.3.X+ mod_proxy_fcgi module) . All other modes do not need that line because they are not using a port to listen on.
« Last Edit: November 22, 2012, 09:53:55 am by bobo »

GiovanniF

  • New member
  • *
  • Posts: 23
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #16 on: March 07, 2014, 02:26:54 pm »
One simple question:

Using this method:

AResponse.Contents.LoadFromFile('aaa.html');

HOW do I incluse a image into my 'aaa.html' like

<img src="someimage.jpg"> ?

Thanks in advance.

Rgds

GiovanniF

RalphMuc

  • New member
  • *
  • Posts: 5
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #17 on: March 31, 2014, 07:35:34 pm »
Hi there

thanks for the docu. Silvio's FastCGI Sample works fine.
Do you know how to pass environment Vars to fastcgi ?


Code: [Select]
procedure TMyAction.Get;
begin

 for I := 1 to ParamCount do
   WriteLn('Param ' + inttostr(I)  +  ': ' + ParamStr(I)); 

 WriteLn( 'myREMOTE_ADDR: ' + GetEnvironmentVariable('myREMOTE_ADDR') );
 WriteLn( 'BROOK_CLT_ENV_HTTP_USER_AGENT: ' + GetEnvironmentVariable(BROOK_CLT_ENV_HTTP_USER_AGENT) );
 WriteLn( 'BROOK_SRV_ENV_REMOTE_ADDR: ' + GetEnvironmentVariable(BROOK_SRV_ENV_REMOTE_ADDR) );
 WriteLn( 'BROOK_SRV_ENV_X_FORWARDED_FOR: ' + GetEnvironmentVariable(BROOK_SRV_ENV_X_FORWARDED_FOR) );

end;     

Solved ...
rgds
Ralph
« Last Edit: May 08, 2014, 11:01:42 pm by RalphMuc »

RalphMuc

  • New member
  • *
  • Posts: 5
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #18 on: May 08, 2014, 11:04:43 pm »
Hi,

the FastCGI sample source code is here : https://github.com/rbmuc/EasyBBS

Ralph

RalphMuc

  • New member
  • *
  • Posts: 5
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #19 on: May 10, 2014, 06:28:45 pm »
Hi,

i build a installable version of Apache 2.4.9 x86  ( with openssl 1.0.1g and FastCGI ) support.
download https://bergertime.eu/download/httpd-2.4.9-win32-x86-openssl-1.0.1g.exe
docu_en https://bergertime.eu/download/apache_fcgi_en.pdf
docu_de https://bergertime.eu/download/apache_fcgi.pdf

Ralph


cahaya

  • New member
  • *
  • Posts: 8
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #20 on: December 12, 2014, 06:41:57 pm »
Hi all,

I just check mod_proxy_fcgi, it work for lazarus with minor bugs(don't know bug or not).
Here my steps :

1. install apache 2.4 (just copy in windows)
2. enable LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so and
    LoadModule proxy_module modules/mod_proxy.so in httpd.conf.
    You can find file httpd.conf in directory conf.
3. add a new line ProxyPass /fcgi-bin/ fcgi://localhost:9000/ in httpd.conf
    /fcgi-bin/ is a directory I put under htdocs, you can put anywhere as long
    as you set permission.
4. add ScriptAlias /fcgi-bin/ "${SRVROOT}/htdocs/fcgi-bin/" under
    alias_module section.
5. add permission
    <Directory "${SRVROOT}/htdocs/fcgi-bin">
    AllowOverride None
    Options None
    Require all granted
   </Directory>

run your program fcgi. Don't forget to add Application.port := 9000;
uses
  fpFCGI, Main;

begin
  Application.Title:='FpCgi';
  Application.Initialize;
  Application.port := 9000;
  Application.Run;
end.
Please notice unit fpFCGI not fpCGI.

You can not use actio, something like /fcgi-bin/helloword.exe/testaction. In cgi action testaction is recognized by both. But in proxy, it seem apache do not compatible with that feature.

chain_reaction

  • New member
  • *
  • Posts: 18
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #21 on: November 06, 2015, 05:22:12 am »
Hello everyone, just to confirm that fp-cgi also works perfectly on lighttpd.

DarkEagle

  • Newbie
  • Posts: 1
    • แรนเถื่อน
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #22 on: May 28, 2016, 07:34:55 pm »
i'm finding on many web , so this thread can help me. thank you very much  ;D

egsuh

  • New member
  • *
  • Posts: 14
Re: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux
« Reply #23 on: March 24, 2017, 06:47:58 am »
Hello,

I've done a few web projects successfully with Delphi on IIS, both CGI and ISAPI.
I found Lazarus recently, and checking feasibility of web application with Lazarus.
I found that fpweb in Lazarus supports CGI and FastCGI. I've tested them on IIS, and found CGI works fine, but FastCGI doesn't work as expected.
I tried to run it on IIS7 (Windows 7) like as follows:

   http://localhost/fcgi/fcgiproject2.exe


but the response is:

    The application encountered the following error:
    Error: Could not determine HTTP module for request "fcgi"
    Stack trace:
    $0000000100036793
    $000000010003685B
    $0000000100036522
    $0000000100036D8F
    $0000000100035FEF
    $000000010003715F
    $0000000100038365
    $0000000100001847 line 16 of fcgiproject2.lpr
     ......................

Interesting point is that "fcgi" is just a folder name, as the executable file path is  c:\inetpub\wwwroot\fcgi\fcgiproject2.exe.  As "c:\inetpub\wwwroot" is the home directory for localhost, specifying "localhost/fcgi" works fine for other types of files. 

I have tested Apache server too, but the results are the same. I think there are some issue related with pathinfo of other thinks as fcgi is not read as a folder name.

If any of you have solved the same problem, please let me know. I would really appreciate.

Regards,


 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus