Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-02

REQ: official FPC's FCGI framework

25 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bee

Hi all,

FPC has pretty usable support for web based development. Currently FPC supports it through CGI and Apache module. IMO, there's one more support that should be added officially: FastCGI. The initial work has been done by ExtPascal project. But, somehow I found it a bit problematic if it's compiled by FPC on non-Windows platform, especially with thread-related.

Hence, I now request for official support from FPC to provide FCGI framework as the third alternative for web based application development. Later, this official framework could be used as alternative FCGI framework for ExtPascal project.

What do you think? TIA.

-Bee-

Reply by email

Michael Van Canneyt
to Bee
Bee wrote 14 lines
Hi all, FPC has pretty usable support for web based development. Currently FPC supports it through CGI and Apache module. IMO, there's one more support that should be added officially: FastCGI. The initial work has been done by ExtPascal project. But, somehow I found it a bit problematic if it's compiled by FPC on non-Windows platform, especially with thread-related. Hence, I now request for official support from FPC to provide FCGI framework as the third alternative for web based application development. Later, this official framework could be used as alternative FCGI framework for ExtPascal project. What do you think? TIA.

I see no reason why this could not be done. Will you coordinate the efforts?

Michael.

Reply by email

Bee
to Michael Van Canneyt
I see no reason why this could not be done. Will you coordinate the efforts?

I'd like to help, especially on testing and bug fixing. But I don't think I have enough knowledge about threading and FCGI internal work. I need people who have the expertise on those 2 fields to do the initial work. ExtPascal author (Wanderlan) doesn't seem very interested to support non Windows platform as he mostly works on Windows (using Delphi).

I'm also quite active in ExtPascal project though mostly on testing and bug fixing but I don't do much on the real coding work. Some enhancement suggestions are also came as my request (CGI gateway, Mac support, enumeration, etc). I can help on the same things here.

-Bee-

Reply by email

Graeme Geldenhuys
to Bee
Bee wrote
can debug my FCGI app (using Lazarus) as if it's a normal desktop application. Something that I couldn't do when using Powtils. :)

That sounds very handy!!! I also use Powtils for our CGI applications. What is the actual difference between FastCGI and CGI? Does FastCGI also work under most web servers?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Bee
to Graeme Geldenhuys
That sounds very handy!!! I also use Powtils for our CGI applications. What is the actual difference between FastCGI and CGI?

You may find all the differences within the article I posted above. But the most wonderful thing is FCGI lives forever since it's a separate application apart from the web server (which acts as an FCGI client).

Does FastCGI also work under most web servers?

FastCGI is indeed a forgotten treasure. It's not a new technology actually, most common web servers had supported it already though disabled by default (or requires additional installation). Since SAAS with very high load hits become common nowadays, people are starting to look at this technology, which IMO is very scalable. That's why some web frameworks/applications requires it (Ruby? Django?).

If your web server doesn't support FCGI, ExtPascal has a CGI-to-FCGI gateway that redirect a CGI request to an FCGI service independently (as long as web server supports CGI protocol).

-Bee-

Reply by email

Graeme Geldenhuys
to Bee
Bee wrote
You may find all the differences within the article I posted above. But the most wonderful thing is FCGI lives forever since it's a separate application apart from the web server (which acts as an FCGI client).

I replied before I read the article. Yes the article explains the differences and reason well. Thanks.
I'm very keen to try FastCGI now, because database connections are the exact issue I have in standard CGI apps. And no, I am not in favour of going for Apache Modules as they are Apache version specific as far as I understand.

At the moment our standard CGI apps have to do exactly what the article says: read config files, parse session variables, establish a new DB connection, build the new page and quit. So far we have good performance as I am very specific with what I retrieve from the database and what goes into the HTML page, but we haven't tested our product on a heavier load.

FastCGI is indeed a forgotten treasure. It's not a new technology actually, most common web servers had supported it already though disabled by default (or requires additional installation).

We have a controlled deployment base and currently use Apache 2 under Linux and Windows. But looking on my local development machine, my Apache 2 only has modules for standard CGI (mod_cgi.so) and not FastCGI. :-( I'm using Ubuntu 7.10.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 29 lines
On Thu, Feb 12, 2009 at 11:02 AM, Bee wrote: > > You may find all the differences within the article I posted above. But the > most wonderful thing is FCGI lives forever since it's a separate application > apart from the web server (which acts as an FCGI client). I replied before I read the article. Yes the article explains the differences and reason well. Thanks. I'm very keen to try FastCGI now, because database connections are the exact issue I have in standard CGI apps. And no, I am not in favour of going for Apache Modules as they are Apache version specific as far as I understand. At the moment our standard CGI apps have to do exactly what the article says: read config files, parse session variables, establish a new DB connection, build the new page and quit. So far we have good performance as I am very specific with what I retrieve from the database and what goes into the HTML page, but we haven't tested our product on a heavier load. > FastCGI is indeed a forgotten treasure. It's not a new technology actually, > most common web servers had supported it already though disabled by default > (or requires additional installation). We have a controlled deployment base and currently use Apache 2 under Linux and Windows. But looking on my local development machine, my Apache 2 only has modules for standard CGI (mod_cgi.so) and not FastCGI. :-( I'm using Ubuntu 7.10.

I think any normal apache supports fastcgi out of the box ? Probably you just need to install another package?

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote
I think any normal apache supports fastcgi out of the box ? Probably you just need to install another package?

It wasn't as part of the default available modules, but a quick search in the apt repository revealed that I needed to install "libapache2-mod-fastcgi" package. Problem is now solved. :-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Bee
to Graeme Geldenhuys: I replied before I read the article. Yes the article explains the differences and reason…
We have a controlled deployment base and currently use Apache 2 under Linux and Windows. But looking on my local development machine, my Apache 2 only has modules for standard CGI (mod_cgi.so) and not FastCGI. :-( I'm using Ubuntu 7.10.

If you need native FCGI support from the web server, you may start from here: http://code.google.com/p/extpascal/wiki/GettingStarted and read the "Setting using native FastCGI, only for Apache 2.2+" section on the bottom.

If you don't need native FCGI support, you may read the "Setting using FastCGI thru CGI gateway (any Apache version and similar procedure on IIS)" section on the same article above.

Personally, I prefer the later because I have better control over the CGI gateway and the FCGI service. Especially during development, you don't want to restart your web server each time you recompile and rerun your program. ;)

-Bee-

Reply by email

Micha Nelissen
to Bee: FPC has pretty usable support for web based development. Currently FPC supports it…
Bee wrote 5 lines
Hi all, FPC has pretty usable support for web based development. Currently FPC supports it through CGI and Apache module. IMO, there's one more support that should be added officially: FastCGI. The initial work has been done

lNet has fastcgi support. Maybe it's interesting for you. It can connect to some server or spawn some itself. Implemented in lib/lfastcgi.pp.

It's used by lwebserver to provide a fastcgi connection to PHP backend. In lib/lwebserver.pp.

Micha

Reply by email

Bee
to Micha Nelissen
lNet has fastcgi support. Maybe it's interesting for you. It can connect to some server or spawn some itself. Implemented in lib/lfastcgi.pp.

I didn't know about this. I'll take a , what I need is *official* FCGI package from FPC as CGI and Apache module.

-Bee-

Reply by email

Michael Van Canneyt
to Bee
Bee wrote 5 lines
> lNet has fastcgi support. Maybe it's interesting for you. It can connect to > some server or spawn some itself. Implemented in lib/lfastcgi.pp. I didn't know about this. I'll take a , what I need is *official* FCGI package from FPC as CGI and Apache module.

You indicated that some kind of fastcgi thing already exists for (free) pascal. Hereby I *officially* request that YOU coordinate efforts to get it integrated in FPC.

I can do some of the work (the gory programming details), but not all.

Michael.

Reply by email

Bee
to Michael Van Canneyt
You indicated that some kind of fastcgi thing already exists for (free) pascal.

So far, I only knew ExtPascal's FCGI. Just now, I knew that lNet had it too, though I still didn't know yet the details.

Hereby I *officially* request that YOU coordinate efforts to get it integrated in FPC.

Alright then. I got ExtPascal FCGI code though I'm not quite sure I understand it comprehensively, but I'd like to try. Then what effort I need to do to integrate it in FPC?

I can do some of the work (the gory programming details), but not all.

The most important support I need is to stabilize the ExtPascal's FCGI thread mechanism in all platforms, especially on non-Windows platforms. Though it works now, but I still found some problems and the current workaround looks hackish rather than elegant solution. While on the other side, I'm not quite an expert on FCGI and multithread programming (especially on non-Windows platforms) to confidently propose alternative solutions.

I also suspect that ExtPascal's current implemented multithread mechanism doesn't fit well on non-Windows platform. Maybe it's because the initial design is too Windows oriented. Multiplatform support added later through FPC (more or less because of my request). I'd be very grateful if there's someone who has expertise on UNIX multithread programming would like to analyze the ExtPascal's FCGI code. :)

Thanks for the support and encouragement, Michael. I appreciate it. :) BTW, it'd be nice if Morfik also supports FCGI. ;)

-Bee-

Reply by email

Michael Van Canneyt
to Bee
Bee wrote 29 lines
> You indicated that some kind of fastcgi thing already exists for > (free) pascal. So far, I only knew ExtPascal's FCGI. Just now, I knew that lNet had it too, though I still didn't know yet the details. > Hereby I *officially* request that YOU coordinate efforts to get it > integrated in FPC. Alright then. I got ExtPascal FCGI code though I'm not quite sure I understand it comprehensively, but I'd like to try. Then what effort I need to do to integrate it in FPC? > I can do some of the work (the gory programming details), but not > all. The most important support I need is to stabilize the ExtPascal's FCGI thread mechanism in all platforms, especially on non-Windows platforms. Though it works now, but I still found some problems and the current workaround looks hackish rather than elegant solution. While on the other side, I'm not quite an expert on FCGI and multithread programming (especially on non-Windows platforms) to confidently propose alternative solutions. I also suspect that ExtPascal's current implemented multithread mechanism doesn't fit well on non-Windows platform. Maybe it's because the initial design is too Windows oriented. Multiplatform support added later through FPC (more or less because of my request). I'd be very grateful if there's someone who has expertise on UNIX multithread programming would like to analyze the ExtPascal's FCGI code. :)

If you send me the relevant units, I'll have a look.

Thanks for the support and encouragement, Michael. I appreciate it. :) BTW, it'd be nice if Morfik also supports FCGI. ;)

Feel free to request it there and refer them to me ;-)

Michael.

Reply by email

Michael Van Canneyt
to Bee
Bee wrote 8 lines
> If you send me the relevant units, I'll have a look. You could get the FCGIApp.pas from http://code.google.com/p/extpascal/source/browse/#svn/trunk Our discussion brought us to: http://bugs.freepascal.org/view.php?id=9016 http://bugs.freepascal.org/view.php?id=10815

I'll have a look during the weekend.

> Feel free to request it there and refer them to me ;-) Unfortunately, I can't request it for free anymore. ;-)

Nope. I had to buy Morfik too. luckily they lowered their prices significantly.

Michael.

Reply by email

Michael Van Canneyt
to Bee
Bee wrote 8 lines
> I'll have a look during the weekend. Thank you very much, Michael. :) > Nope. I had to buy Morfik too. luckily they lowered their prices > significantly. Does purchasing include Developer Assist support?

No, you have to pay extra, but at least if you purchased it, you get a reply to a mail.

Michael.

Reply by email

Bee
to Jonas Maebe
Yes, but it's fixed in 2.2.2

ExtPascal author claimed that it's still reproducable in FPC 2.2.2 and 2.3.1. Perhaps it's fixed but ExtPascal's multithreading mechanism is wrong somehow, or perhaps the other way around. I'm not sure.

-Bee-

Reply by email

Jonas Maebe
to Bee: ExtPascal author claimed that it's still reproducable in FPC 2.2.2 and 2.3.1. Perhaps…
Bee wrote
> Yes, but it's fixed in 2.2.2 ExtPascal author claimed that it's still reproducable in FPC 2.2.2 and 2.3.1.

It is not. Just try the test programs in the test suite. There is however a related bug which has been fixed in 2.3.1 recently: http://bugs.freepascal.org/view.php?id=13105

That is a documentation bug, as far as I'm concerned (and unless extpascal uses only beginthread without endthread, it does not affect that framework).

That's unlikely to be the problem, since most people call x.free rather than an unqualified "destroy".

Jonas

Reply by email