[fpc-pascal] FCL-WEB and PostgreSQL Support: Current Status

Michael Van Canneyt michael at freepascal.org
Thu Sep 28 23:11:38 CEST 2017

On Thu, 28 Sep 2017, Daniel Gaspary wrote:

> On Wed, Sep 27, 2017 at 12:53 PM, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> Apache, indeed using FastCGI. Used both mod_fastcgi as mod_fcgid. mod_proxy
>> should work as well.
> What do you use to debug this environment, just log messages / log server..?

See below.

> Sometime ago I have seen someone mentioned developing with a separated
> application which communicated to the cgi / fastcgi part. This Cgi /
> fastcgi part was used just to receive / response requests from / to
> the web server. This way the debugging became much easier.
> My question: How this application communicate with the Cgi / FastCgi part?

You don't need that at all, that is way too complicated.

You have 3 options to debug:

1. You can perfectly start the fastcgi in the debugger if you use proxy server
or if you use mod_fastcgi confgured with fastcgiexternalserver configuration
setting. I believe nginx only uses the proxy mechanism.

2. If that is not an option, there is also the following:
FPC contains a cgi to fastcgi request converter, you can use that to debug
the fastcgi by running it inside the debugger, and let apache forward the
request using the cgi bridge.

3. Third option:
    FCL-Web is transparant in the sense that the code for CGI/FastCGI/Apache
    module or standalone HTTP server is 100% the same. Only the used
    TCustomApplication descendent differs for these 4 environments.

That means you can debug your code using the HTTP server, and switch to
using FastCGI in production. I use an {$IFDEF } in the project file to
switch the hosting environment. For the business code this is transparant.

> TSimpleIpc seens to only communicate one way. Anyone using two
> TSimpeIpc's components to simulate a duplex channel?
> Any chance of extend the component / create a new one, with support to
> receive and send data ?

No. I don't see the need. 
See above, there are plenty of mechanisms to debug a web environment.


More information about the fpc-pascal mailing list