[fpc-pascal] Re: CGI (with Free Pascal) vs PHP

Jason P Sage jasonpsage at jegas.org
Tue Mar 6 15:03:51 CET 2007

I would like to put my two sense in because I have been doing extensive
FreePascal Web programming, and I have to agree that FreePascal has a
nice structure and PHP often can get quite ugly.

For many applications PHP is just fine. 

The points you guys are bringing up are good ones - like security with
"text injections" possibly begin exploited with PHP and for rather large
complex applications - things can get dicey in PHP - as far as hard to
maintain and performance becoming an issue. But in all fairness - well
written PHP can do many great things.

PHP has many "features" that FreePascal doesn't, and FreePascal has many
features that PHP doesn't. What is available for each will likely change
over time.

Personally, I'd rather have my FreePascal Syntax, smartLinking, Socket
library, multi-threading library, ability to call dlls, inline
functions, true object oriented binaries versus emulated OO script
(Which is likely OOP underneath but it still parsed).

I can write a desktop application, a web application, an embedded
application, a database application, a daemon - all with one language.

PHP was never designed to be quite this flexible. My point is, like
Daniel said "Better learn a good language"; I'd rather learn a language
I can use for anything - than another vogue special interest language
only because you be a master in a couple things - but not in everything.
FreePascal has all the power required to create any kind of application
- therefore - I can ultimately do much more with it.

I've written a CGI application in FreePascal that gets some performance
gain over typical CGI from a file based IPC. The CGI app just passes
environment and request info to the main multi-threaded database
application, and then sends the output back to the client when the big
application finishes its thread. The idea being a small CGI program that
doesn't grow as the application grows - is better than the typical CGI
app that gets bigger and bigger as it evolves getting slower all the
time. CGI is very portable. Performance is decent for a CGI application.
FastCGI and a stand alone server are the next additions to this model
for performance reasons.

PHP versus FreePascal: It's like an internal combustion airplane versus
a Jet Airplane to me. You Might get the internal combustion airplane off
the ground faster (PHP) but a Jet airplane will go farther and faster
every time.(FreePascal of course).

Seriously - with FreePascal I can write FastCGI that does what I want
versus what is available for PHP, I can write to any protocol I want,
and it simply has all the power I'll ever need - for any application.

PHP is great also. I'll put my mmoney on FreePascal because it goes
farther, faster, and can handle the long haul.

Jason P Sage

More information about the fpc-pascal mailing list