Join Bytes! wrote:[color=blue]
> Hi,
>
> I am trying to figure out if I should learn C and C++ to write CGI
> programs, or if I should just use PHP for my web site.
>
> I want to write a high traffic website that would call executibles a
> lot dealing with text.[/color]
CGI of any kind is one of the slowest, worst-performing ways imaginable
to do anything. As another poster mentioned, things like Apache's
mod_fcgi make it easy to adapt a CGI to run inside the server for vastly
improved performance, but there's little reason to set out to write a
C/C++ CGI in the first place these days.
C/C++ compiled into native server modules, not as CGI, can indeed be
extremely fast. But practically nobody writes web applications that way
except maybe Google, and not even them for a lot of the things they do.
Nearly every high (VERY high) volume website is now done in the likes of
PHP, Java, Python, Perl, VB Active Server Pages, and other high-level
languages, and none of them ever as a CGI. Yahoo itself is transitioning
away from its own in-house scripting language to PHP. I think their
mapping site uses Python, and I think their shopping site uses LISP. In
the case of interpreted and runtime compiled langauges like Perl and PHP
there are readily available, free, mainstream server modules (e.g.
mod_perl and PHP accelerators) that compile the scripts transparently
the first time they're run and have them running at speeds comparable to
C from there on out.
The exceptions to the rule, where people opt to write a web app in C
these days, are usually for embedded devices where memory is at a
premium, or for the "connectors" that other programming languages like
PHP use to interface with the webserver.
You are probably not doing anything higher-volume than Yahoo. Write your
application in whatever language you and your team will be most
comfortable with and is best suited to the application. A low-level
language like C is probably not that language.
[color=blue]
>
> Are CGI programs written in C faster then PHP script programs?[/color]
No. CGIs that have been made thread-safe and then run under a fast-cgi
module can be, sometimes. But you will spend far more time writing it
and you'll have several times the amount of code to maintain.
[color=blue]
>
> Nick[/color]