|
-
Jan 18th, 2004, 06:47 PM
#1
Thread Starter
Fanatic Member
What is the difference between PHP and CGI (perl)? Which is best and Why?
The subject says it all really.
I am attempting to delve deeper into web server technologies and was wondering what the difference between PHP and CGI (perl) is and which you prefer and why?
Thanks
-
Jan 18th, 2004, 08:29 PM
#2
PHP was originally built from Perl, so there is a lot of similiarity between the syntax of both languages. Rasmus Lerdorf (the creator of PHP) originally made up PHP (then known as "Personal Home Page") as a group of Perl scripts that tracked visitors to his website.
PHP was designed to be used with web applications, while Perl was more designed towards system-scripting. Essentially, Perl is the more powerful language and preferred for system-scripting, although PHP can also be compiled as a module and be used for system-scripting. For me, for web scripting I'd choose PHP, and for system-scripting I'd choose Perl. With PHP, you have great flow controls and file pointers for efficient file input and output, but that's only good for the web. Both languages can be more efficient for you, but it will all depend on what you are planning to do. Perl for system, PHP for web.
I started using Perl in '98/'99, and up until around the start of May of '03 that's the only server side language I had dipped into. I had used Perl for all sorts of web development, and made many 1000+ line programs that worked fine. After that, I started learning PHP, and have left Perl behind. Perl is complex, and to make a simple script it could take 40 lines, while a PHP script that does the same thing would take less than 10. When I was looking back at some of my old Perl scripts, I decided I'd remake one, and although I half quit doing that because I lost my inspiration, I had found that by doing it in PHP I would have more functionality with less code used, and less of a load on the server since when using PHP I used several PHP scripts instead of, in Perl, using one 1500+ line script. So, PHP is a faster language in web development.
Hope that helps you a bit.. and I hope I didn't confuse you on anything. I might have some of the information wrong in it, I went mostly off of the top of my head and off of a site I have.
Read more about the differences here: http://code.box.sk/newsread.php?newsid=213
-
Jan 18th, 2004, 10:06 PM
#3
Stuck in the 80s
Search the forums. This has been asked (and debated (in blood)) many times.
-
Jan 19th, 2004, 04:11 AM
#4
Thread Starter
Fanatic Member
Thanks Kows, that explained it very well, you didn't confuse me.
Hobo, to be honest with you I forgot to search the forum. I will do that now.
-
Jan 19th, 2004, 05:30 AM
#5
Thread Starter
Fanatic Member
I understand the comparison between PHP and CGI is a very live subject but how does it all relate to ASP.
We are in the process of moving to ASP.NET, (I am going on some training next month). I have used ASP2 a little. If I am using ASP.NET properly do I even need to use a scripting language like PHP or CGI.
AS PHP pages require a file extension of PHP then that throws mud in the eye of using ASP doesn't it. You can't then have a file extension of ASP.
I understand you can have PHP embedded in your page but can you call PHP script files like you can with CGI.
I did search the forum but found no mention of ASP in the PHP forum. Maybe that is the answer my question about how ASP and PHP relate to each other.
-
Jan 19th, 2004, 06:10 AM
#6
That's because ASP and PHP are competing technologies.
There are many ways to do dynamic pages.
1) PHP. Open Source project, free, runs on Windows (IIS and Apache), Linux (Apache) and maybe some other *nix platforms. Scripting in PHP.
2) Servlets/JSP. Open standard by Sun, essentially free. Runs everywhere there is a Java Virtual Machine. "Scripting" in Java.
3) ASP. Microsoft's proprietary technology. Runs only under IIS. There are some porting projects, but because ASP is so geared toward Windows, they are limited. Scripting in JScript or VBScript.
4) ASP.Net. Successor to ASP. Runs under IIS with .Net installed, but to a certain extent also under the Mono project. Scripting in any .Net language, usually C# or VB.Net.
5) CGI. International standard. Supported by virtually every server there is, with the exception of a few miniservers. Because of its architecture, it's usually slower than other technologies. "Scripting" is done in anything the OS supports. It can be scripts that are run by an interpreter (e.g. Perl). It can be real executables. I wrote a tiny CGI script in Assembly once in school.
There are more technologies, but these are the most popular. Each has its advantages and disadvantages. But one thing is sure: unless you absolutly have to, don't use ASP. If you want to use an MS technology, use ASP.Net.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 19th, 2004, 07:08 AM
#7
Thread Starter
Fanatic Member
We will be using ASP.NET that is a management decision.
Learning PHP or CGI will be a personal spare time achievement.
Thanks.
-
Jan 19th, 2004, 09:09 AM
#8
Stuck in the 80s
What is the reason why management mandated ASP.Net? What kind of work do you do?
-
Jan 19th, 2004, 11:08 AM
#9
What is the reason why management mandated ASP.Net?
Death threats from MS 
Learn the theory of CGI, then PHP.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 19th, 2004, 11:15 AM
#10
Thread Starter
Fanatic Member
I work for a local college in the Information Systems department.
We publish data via web browser, so usually its basic stuff.
We also write in house applications for the admin staff, student records etc.
Everyting is basically microsoft.
-
Jan 19th, 2004, 11:23 AM
#11
Stuck in the 80s
Originally posted by davidrobin
I work for a local college in the Information Systems department.
We publish data via web browser, so usually its basic stuff.
We also write in house applications for the admin staff, student records etc.
Everyting is basically microsoft.
Once you work your way into upper management, remember that microsoft = $$.
Unless you're heavily into other Microsoft products and need ASP to interact with them somehow, I see no reason why PHP would work for your needs.
Unless I'm mistaken, Windows costs money, IIS costs money, and ASP costs money.
Linux is free, Apache is free, PHP is free, and MySQL is free.
Remember that when you get in that high seat.
-
Jan 19th, 2004, 01:32 PM
#12
I see no reason why PHP would work for your needs.
I don't either 
Upper management in a local college?
Remember this too:
MySQL runs in Windows, Apache runs in Windows, PHP runs in Windows. Later, when you switch to the definitly better server OS, you don't need to change a single line of code.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 19th, 2004, 02:08 PM
#13
-
Jan 19th, 2004, 06:08 PM
#14
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 19th, 2004, 06:12 PM
#15
Stuck in the 80s
Originally posted by CornedBee
-
Jan 20th, 2004, 04:09 AM
#16
Thread Starter
Fanatic Member
I have taken everything you have said and acted on it.
As a sign of protest against Upper management and microsoft I resigned today.
Only joking!!!
For the last few days I have been trying to find a decent web server that I can install on XPHome. I avoided Apache originally because I wanted on with a nice GUI interface.
Anyway yesterday I successfully installed (after 3 attempts) to install Apache. This is so I can do my personal web development. I will not be using it as a live web server so security is not an issue at this stage. I will have to learn it in time. I did notice there is a gui project ongoing.
I am also about to install ActivePerl, PHP and MySQL.
This, I am hoping will give me the chance to learn som of the REAL WORLD web development technologies rather than being tied down to microsoft technologies.
Unless I'm mistaken, Windows costs money, IIS costs money, and ASP costs money.
I have noticed that Linux hosting is cheaper than Microsoft, this in itself is reason not to go with microsoft (The resistance grows stronger).
-
Jan 20th, 2004, 07:08 AM
#17
Does IIS have a graphical interface?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 20th, 2004, 08:48 AM
#18
Thread Starter
Fanatic Member
It does,
but as I don't have XP pro at home I cannot install it.
-
Jan 20th, 2004, 09:15 AM
#19
Who needs a graphical interface anyway? Waste of resources if you ask me.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 20th, 2004, 09:16 AM
#20
Stuck in the 80s
Why want a graphical interface? I like Apache where I can just run it and never see it until I shut it off.
MySQL for Windows has an interface (WinMySQLAdmin or something), and that's a poorly written application, IMO.
-
Jan 26th, 2004, 02:02 AM
#21
Fanatic Member
I like gui interfaces because I'm somewhat of a dyslexic typer, command line stuff gets me mad 
I like to dabble in all sorts of languages,servers, databases etc so I don't limit myself. I tend toward the microsoft side of things simply because they are the dominate power in corporations. Why? Management is stupid, they want something familiar something with a big brand, they feel the more money you spend on something the better it is and simply because they're not aware of the alertnatives.
Don't get me wrong, apache is great, but it's a little more than annoying to set up at times, I remember the frustrations of doing it more than once, where IIS is all click next click next blah blah there you go. Not to mention on IIS I can run PHP (my new favorite), ASP, ASP.NET, CGI/PERL, etc (its kind of a piss off that microsoft not only hordes their scripting laguages but they support the guys trying to make it available, but that's life I guess).
If wishes were fishes we'd all cast nets.
-
Jan 26th, 2004, 09:25 AM
#22
Apache for me was
"Agree to the license?"
"Where to install it?"
Done.
Even compiling it on my own PC was a snap.
Though I admit I didn't install PHP with it.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 26th, 2004, 01:55 PM
#23
Frenzied Member
PHP was a little confusing to install with Apache, but I would say it was far from "hard". www.php.net tells you exactly how to install it.
-
Jan 26th, 2004, 02:28 PM
#24
Fanatic Member
you know what, I'm getting apache and mysql confused.
If wishes were fishes we'd all cast nets.
-
Jan 26th, 2004, 02:29 PM
#25
Frenzied Member
***? One is a web server. The other is a database.
-
Jan 26th, 2004, 03:42 PM
#26
Fanatic Member
I use mysql heavily with a lot of websites I develop so I install apache and mysql on a lot of servers at the same time.
If wishes were fishes we'd all cast nets.
-
Jan 27th, 2004, 03:48 AM
#27
Thread Starter
Fanatic Member
Are these windows or linux servers?
Do you have a set installation document you follow or do you do it from memoruy?
-
Jan 27th, 2004, 05:41 AM
#28
Fanatic Member
windows mostly, done from memory
If wishes were fishes we'd all cast nets.
-
Jan 27th, 2004, 06:28 AM
#29
Thread Starter
Fanatic Member
I was asking because it is interesting to know how other people install and configure apache, mysql as I have done it for the first time and probably rather hap-hazzardly. A little tweak here and there after asking questions.
How secure it is I don't know. I think its OK. As it is on my own machine and not networked I don't need to worry too much, its just good to know.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|