![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Nov 2005
Location: Estonia
Posts: 97
Rep Power: 0
![]() |
CGI vs. PHP
Why do so much people use PHP? I've got the impression that CGI is a lot better than PHP. Maybe I'm wrong?
|
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
CGI isn't a language, it's an interface. You can't compare dogs and doughnuts (well, maybe you can, if you eat dogs). Your statement is absolutely meaningless.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Nov 2005
Location: Estonia
Posts: 97
Rep Power: 0
![]() |
I'm not stupid. CGI (common gateway interface) is a way of programming web sites. It works like this: someone visits /index.cgi and an app is executed on the server which output is displayed in an html file.
I wanted to know why should I use PHP to make websites not some scripting language or anything. I have seen a cms made in python for example. Why do people make sites in PHP not in some "regular" programming languages? |
|
|
|
|
|
#4 | |
|
Hobbyist Programmer
|
Quote:
You got the right idea. Just know that php isn't any different than python or other CGI languages. |
|
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
CGI is NOT a type of programming language. CGI is a specification for an interface technology. Any number of languages, including PHP, may institute communications in conformance with that interface.
PHP IS a "regular" scripting language. There are many more. Even compiled languages may be used. I did not say you were stupid, but you seem set on convincing me.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
PHP can be used with CGI or as an Apache module (mod_php). The latter is faster because a seperate process doesn't have to be started with each page request...
Microsoft's IIS uses ISAPI, in many ways similar to Apache's modules. ISAPI, Apache modules, and CGI are merely ways to facilitate extension of the server. PHP, Perl, Ruby, and others are available in different flavors to match whatever the server happens to support. mod_php, mod_perl, mod_ruby on the Apache side, I recall that some of the above support ISAPI, and invariably CGI as an unpleasant fallback.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#7 |
|
Professional Programmer
|
commodore,
since the early days of the web, the biggest scripting langauge for server side stuff was PERL. It's powerfull, and people knew how to use it. So when they created ways to make a CGI for web development, PERL was their choice. bit because PERL needed different permissions and configurations (since PERL is, after all, a unix scripting language) in order to run from a web browser, it needed it's own folder. This folder was called the CGI-BIN. Over time, different ways of applying CGI were used in web sites. ASP ran through Microsoft's IIS Web Server software and didn't require it's own folder. Java Server Pages ran on apache via Tomcat. PHP was written as a module for apache, hence they didn't need their own folders. If someone had, for example, installed the CGI version of PHP rather than the apache module, you would need a CGI-BIN like folder to stick your PHP into. (Just elaborating on what Dameon said). Ruby I believe is stuck right into apache as well. Over time, things changed. I've used servers were you do not need to have perl scripts in your CGI bin to have them work just fine. But usually you do, so CGI for web was associated with PERL. You're thinking of PERL with this thread, not "CGI". To answer your initial question, why do people use PHP as oppose to PERL: It's easier to write, develop, debug, you don't need any different settings on it, it's easily portible (so that it will work on PHP on windows, linux, bsd, whatever without complications), and it plays very nicely with databses and has a lot of nice built in functions. PERL is more heavy duty, no doubt about it and the old school web developers still prefer it. But a lot of people feel that PHP will replace Java and PERL as the biggest server side web language. My advice to you is to judge for yourself. Do some perl tutorials, do some php tutorials. See which language you like best and which is easier to work with. |
|
|
|
|
|
#8 |
|
Programmer
Join Date: Nov 2005
Location: Estonia
Posts: 97
Rep Power: 0
![]() |
Everyone understood me wrong. I haven't thinked that CGI is a language or anything. The name of the thread was just wrong. And I didn't know that PHP is used with CGI (sorry again if I wrote the sentence wrong).
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|