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
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
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
Search the forums. This has been asked (and debated (in blood)) many times.
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.
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.
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.
We will be using ASP.NET that is a management decision.
Learning PHP or CGI will be a personal spare time achievement.
Thanks.
What is the reason why management mandated ASP.Net? What kind of work do you do?
Death threats from MS ;)Quote:
What is the reason why management mandated ASP.Net?
Learn the theory of CGI, then PHP.
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 = $$.Quote:
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.
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.
I don't either :pQuote:
I see no reason why PHP would work for your needs.
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.
Er, make that "wouldn't" :o :D
:(
:confused:Quote:
Originally posted by CornedBee
:(
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.
I have noticed that Linux hosting is cheaper than Microsoft, this in itself is reason not to go with microsoft (The resistance grows stronger).Quote:
Unless I'm mistaken, Windows costs money, IIS costs money, and ASP costs money.
Does IIS have a graphical interface?
It does,
but as I don't have XP pro at home I cannot install it.
Who needs a graphical interface anyway? Waste of resources if you ask me.
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.
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).
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.
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.
you know what, I'm getting apache and mysql confused.
***? One is a web server. The other is a database.
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.
Are these windows or linux servers?
Do you have a set installation document you follow or do you do it from memoruy?
windows mostly, done from memory
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.