views:

144

answers:

4

In a book I'm reading, the author says "Most dynamic Web pages on the Internet are created with CGI and scripting languages". This isn't true anymore, is it? Aren't other technologies like PHP or ASP more widely used than CGI nowadays? I'm not sure how to find out stats for something like this. Thanks...

+1  A: 

How old is the book?

CGI is old and hasn't been encourage for some time. There is probably a surprising amount of it hidden away. Some sites use URL rewriting to avoid breaking old links so you may see a lot of .cgi links which are in fact other technologies.

BrianLy
Thanks. The book is current; hasn't even been published yet, in fact, although it's a revision of an older book, so this seems like something that needs to be updated for currency. (I'm reviewing it in development.)
Jack
A: 

I would have thought that PHP far outweighs CGI nowadays. This will be mainly due to the majority of free/cheap hosts supporting PHP, PHP's relatively low barrier to entry for novice users, and that Wordpress is so popular as a blogging platform.

adrianbanks
PHP is a language. CGI is a protocol. You can't really compare them. mod_php and CGI could be compared.
David Dorward
I understood the question to be comparing PHP/ASP to CGI scripts.
adrianbanks
A: 

CGI, as in directly running an executable and sending its output to the browser, is dead. However, the CGI protocol lives on in more modern techniques such as FastCGI. FastCGI is used all over the place, for many different types of languages -- for example, PHP has a FastCGI mode which it uses to interact with the HTTP daemon.

Ditto for the use of scripting languages. There are probably some old script-based pages lurking around, but most websites have moved on to "real" languages such as Python, Ruby, C#, or Java.

John Millikin
A: 

CGI is just a standardized way for a webserver to talk to a program.

Even if your scripts aren't running through PHP, the CGI environment variables continue to exist. In PHP, you access these through the $_SERVER array.

Additionally, PHP itself can run in CGI mode. In fact, with Apache, if you want PHP to run as the user that owns each PHP file, you need to run it via CGI or a similar mechanism (such as suphp).

R. Bemrose