Results 1 to 24 of 24
  1. #1
    Join Date
    Jun 2002
    Location
    houston, tx
    Posts
    544

    Perl (CGI) vs. PHP

    I am currently installing a new script for some of my better hosting customers.

    The script comes either as Perl (cgi) or PHP.

    Both are the exact same (as far as I can tell) and same price.

    Which do I choose & why? My only justification is that the PHP may be less demanding on the server itself, and may perform better - but I am not an expert in this area.

    I run red hat server with MySql.

    Thanks in advance.
    Joe - HostingWave.Com / TXINSURANCE.COM
    http://www.hostingwave.com
    SURGEON GENERAL'S WARNING: Smoking Causes Lung Cancer, Heart Disease, Emphysema, And May Complicate Pregnancy.

  2. #2
    Join Date
    Mar 2002
    Posts
    1,003
    PHP will be easier for you to maintain.

  3. #3
    Join Date
    Jun 2002
    Location
    houston, tx
    Posts
    544
    Shyne - give me an example why it would be easier. Thanks..
    Joe - HostingWave.Com / TXINSURANCE.COM
    http://www.hostingwave.com
    SURGEON GENERAL'S WARNING: Smoking Causes Lung Cancer, Heart Disease, Emphysema, And May Complicate Pregnancy.

  4. #4
    I find PHP scripts to be less resource intensive and smoother running. PHP error messages also tend to be more descriptive, which is great for debugging. And...though it really isn't fun to talk about...if a client leaves, it's easier for them to reconfigure a php script than a perl script when they get on another server.

  5. #5
    Originally posted by loopforever
    I find PHP scripts to be less resource intensive and smoother running. PHP error messages also tend to be more descriptive, which is great for debugging.
    Well, Perl error messages can be just as helpful. It's just a matter of writing the script to report them properly. While PHP does most of the error reporting for you, you have to program with error reporting in mind when using Perl.
    Matt Lightner - http://www.mattlightner.com/
    - First initial to the last name at the mail service provided by the world's largest search engine
    - Founder and CEO (Former) Site5.com, sold in 2008
    - Really honestly wants to be a good WHT citizen but can never remember all the correct etiquette. Mods, sorry in advance

  6. #6
    Join Date
    Jul 2002
    Posts
    153
    I find when writing in PHP things are done much more simplier and with less lines and effort than done in PERL. I think its just a matter of choice but as for CPU power go for PHP --- its quicker.

  7. #7
    Join Date
    May 2002
    Location
    UK
    Posts
    2,994
    Originally posted by Site5-Matt
    Well, Perl error messages can be just as helpful. It's just a matter of writing the script to report them properly. While PHP does most of the error reporting for you, you have to program with error reporting in mind when using Perl.
    Quite but I doubt there are that many clients in the shared hosting environment know how to write error reporting functions in Perl so at least in PHP it's done for you.

  8. #8
    Ultimately, though, a poorly written script is going to be a problem in any language. The language it is written in doesn't, necessarily, have any bearing on how preferrable, or otherwise, it is.

    I would suggest that you go with whichever script is written in a language that you understand, have most experience with and can troubleshoot. If you don't have that ability and the script is from the same developer, I would suggest simply asking the developer the same questions you have asked here. They're in the best position, in that situation, to recommend which would be most suitable to your environment.

  9. #9
    Join Date
    Jul 2002
    Location
    UK
    Posts
    79
    Points to note:

    1. PERL is not CGI

    2. CGI is a interface system

    3. Yes PHP can run faster (built in apache module) but only if the script is coded well
    (which a lot are not)

    4. A well written PERL script (which a lot are as it dont allow sloppy coding) will give a PHP script a run 4 its money anyday

    5. With PERL scripts look for
    use strict;

    at the top of the file. Infact only use PERL scripts running under strict.
    Proxima Web-Hosting

  10. #10
    I think you must use PHP/MySQL scripts.Becouse, these scripts very speedy and uses very low system resources.

    Have nice day
    Signature edited. Please see Forum Guidelines for more information.

  11. #11
    Join Date
    Jul 2002
    Location
    Mexico
    Posts
    57
    No doubt about it.....PHP gets my vote.

  12. #12
    Join Date
    Jul 2002
    Location
    UK
    Posts
    79
    Originally posted by 1upromo
    I think you must use PHP/MySQL scripts.Becouse, these scripts very speedy and uses very low system resources.

    Have nice day
    Very Speedy WOW what a statment

    My car very speedy but not going to run my website on it LOL

    I would be nice to find a community where questions like this are anwser by people who know WTF they are talking about

    AND FOR YOUR INFORMATION

    PERL is only slowed down as it must run though CGI -> PERL is a superior language (Only a idiot would write server admin scripts in PHP)
    Proxima Web-Hosting

  13. #13
    Join Date
    Jan 2002
    Location
    Tallahassee
    Posts
    37


    You can write command line php scripts ... so what's the problem?

    I've had perl crons that have died out for no reason ... what makes them better? I run both perl and php crons ... who's to say which is better.

    "I would be nice to find a community where questions like this are anwser by people who know WTF they are talking about"

    There's plenty. The REAL problem is that WebHostingTalk.com is NOT one of them. It would be MUCH better suited over at SitePointForums.com.

    http://www.outcrier.com
    http://www.epock.com

  14. #14
    Join Date
    Nov 2001
    Location
    Vancouver
    Posts
    2,416
    Its amazing how little understanding there is of the differences between different languages and web development frameworks.

    PHP is a language with features that make it easy for someone with little web knowledge to get started, and therein lies its appeal.

    But it isn't the only fish in town. Perl, Python, TCL, Ruby, etc, there are a ton of choices out there. Most require more knowledge on the part of the web developer and administrator if you expect to get anywhere near the performance of PHP built into Apache. But, it can be done.

    Example - Apache Benchmark against three targets that all return the same content.

    index.html - raw html, no other processing happening

    demo.cgi - a Python CGI script that churns through 5500 lines of Python code (Quixote, a web application framework built in Python)

    demo.lrp - the same code as in the prior example, but this time run as a long running web process in a manner similar to mod_php or mod_perl (I am intentionally over-simplifying the differences for this discussion) etc.

    Results:

    Code:
    ab -n 2000 -c 8
                       requests/second         transfer rate
    index.html       2877                           4487.94
    demo.cgi           12                             18.24
    demo.lrp          835                           1248.12
    Impact on the box:
    index.html - Running the test against straight html is very quick as you'd expect. It runs so fast that its difficult to gauge the effect on the machine except that its clear there is lots more capacity sitting in reserve. Load might be around .40 - .50 / 60-75% idle.

    demo.cgi - Load average on the box peaked at over 8.50 and the CPU's were 0% idle (mostly user)

    demo.lrp - Load about .30 - .50, CPU idle 35%, very approximately

    Conclusions - of course CGI is a performance pig. What do you expect when you are loading a 5MB interpreter for every page hit! But that doesn't make Perl or Python 'bad', it makes CGI 'bad' or at least inappropriate for any large scale application that will see some traffic.

    With some stats, its easy to see why more than a passing knowledge of web applications is required. But most of your users (and a surprising number of web hosters themselves) are completely clueless about web application infrastructure.

  15. #15
    Join Date
    Jul 2000
    Location
    Atlanta, Georgia, USA
    Posts
    208
    My answer is simple, write the script in Scheme and forget about both Perl and PHP!

    On a more serious note...

    The choice of language take on several forms and I avoid saying that this is ALWAYS better than that. In the Windows app world this type of argument often took on the form of Visual Basic vs. C/C++. Yes, C/C++ apps can do everything and more than VB applications, yes they run faster and are harder to decompile, but that does not make VB a bad platform for development.

    Perl is good and runs fine, but I tend to like using PHP much better these days. When deciding look at which you think you are going to be more comfortable with. What are other applications running on your website going to be using? There are benefits for keeping everything consistent.

    Best regards,
    Frank Rietta
    AtlantaWebHost.com, a service of Rietta Solutions
    Web Site & Development Hosting, Dedicated, Colocation, DNS, Atlanta-area T1 for Voice & Data

  16. #16
    PHP..... ummmmm, because it rocks! And, ummm, because I've looked at perl and I don't understand it.

    So, to re-iterate my opinion

    1: It rocks.
    2: I don't understand perl.

    For real, unless this is some sort of script that will be running 24/7 with millions of hits, I don't think it really matters to you if it's written in php or perl. If you knew php or perl, I'd say go with what you know. Or ask your customers.

    If it's that intensive, get both and compare the load on the server. Choose one and tweak your server to handle the load.

  17. #17
    Join Date
    Feb 2002
    Location
    Peoria AZ
    Posts
    52
    all languages are good for what they are good for.
    I like PHP, but that is an opinion. PERL just gives me a headache.
    Then again, I also like VB better than C++, which immediately makes me look like a fool in some circles, and a champ in others. And I don't like JAVA, which makes me, uhm, like PHP even more.
    I can code in all these languages, but I've written more PHP in this past year than all other languages combined (including JavaScript) because it is so elegant and intuitive.
    You want to see a really mean argument? Go to alt.php and post a message saying why you think ASP or PERL is better than PHP. They will have your head over there.

  18. #18
    Originally posted by MCP
    Go to alt.php and post a message saying why you think ASP or PERL is better than PHP. They will have your head over there.
    By the same token, go to comp.lang.perl.misc and say that PHP is more "speedy" and see what they say...

    Perl and PHP are both excellent languages, and can't be juxtaposed properly in a matter of a few sentences.
    Last edited by Matt Lightner; 07-23-2002 at 04:20 AM.
    Matt Lightner - http://www.mattlightner.com/
    - First initial to the last name at the mail service provided by the world's largest search engine
    - Founder and CEO (Former) Site5.com, sold in 2008
    - Really honestly wants to be a good WHT citizen but can never remember all the correct etiquette. Mods, sorry in advance

  19. #19
    Join Date
    Dec 2000
    Location
    East Coast
    Posts
    1,747
    Originally posted by AtlantaWebhost.com
    My answer is simple, write the script in Scheme and forget about both Perl and PHP!
    *spitting soda back out* hhahahahahahahaah

    ahhh, lol - ah man... nice one. Funny thing is, I learned Scheme in Atlanta (GT) and my thoughts on that language was always

    *ahem* in the matter of the original thread... I would say it really depends on what kind of script it is... if its something simple - then I would choose either one. If its something complex that handles parts of the server (like administrative tools) then I'd use Perl... if its something complex but something that's going to be used in the open (like message board or helpdesk) then I'd say go with PHP.

  20. #20
    Join Date
    Jul 2000
    Location
    Atlanta, Georgia, USA
    Posts
    208
    ahhh, lol - ah man... nice one. Funny thing is, I learned Scheme in Atlanta (GT) and my thoughts on that language was always
    Ah, the simple pleasures of CS1321 (1311). Nothing quite as fun as C, the Greenlee way.

    I do not use Perl. If I need to write a script to do something I use PHP, both web scripts and shell scripts. If a program needs to run as quickly as possible with the smallest possible footprint, I do not use any scripting language, but ANSI C.

    Best regards,
    Frank Rietta
    AtlantaWebHost.com, a service of Rietta Solutions
    Web Site & Development Hosting, Dedicated, Colocation, DNS, Atlanta-area T1 for Voice & Data

  21. #21
    Join Date
    Nov 2001
    Location
    Vancouver
    Posts
    2,416
    But Matt, its so satisfying to say "my language rocks" phhfft so there!

    - Python rocks, more.

    “Even those who arrange and design shrubberies are under
    considerable economic stress at this period in history.”

  22. #22
    Join Date
    Sep 2000
    Posts
    368
    I luv this argument...

    a really great question is HOW BUSY IS THAT SCRIPT GOING TO BE?


    if youre doing ecommerce do you really beleive your new shopping cart is going to be pounding out 10k sales per month?

    lets be honest now...

    in that case the speed of the script is not an issue.

    for a bulletin board only php
    for a portal vb and sql or cold fusion


    three types of situations
    three suggestions

  23. #23
    Wow, 2 Gatech students on the same thread.


    I luckily had Pseudocode instead of scheme. I would rather them switch to using VB than teach that useless mess of a language (Scheme).


    BTW, Greenlee no longer teaches CS 2130, he still makes the tests, but the honors of teaching have been passed on to Bill, and some other guy.
    Chairman and CEO
    ENetExperience LLC

  24. #24
    Join Date
    Dec 2000
    Location
    East Coast
    Posts
    1,747
    Although, I don't like to post OT - I just gotta .... just glad to see GT students/alumns here I just finished my freshman year and prepping for my Sophomore year. I was just too shocked to see how seriously GT considered their CS classes (especially since that class is required for almost all majors if not all) but I guess that was because of the lack of challenge in my high school CS courses which taught C++ straight out of the book.

    Although I won't be taking CS this coming semester (I'm a CompE major), I'm hearing that Digital Signal Processing will take some time off my hands - anyhow, I heard about the infamous Greenlee... but then again, I heard A LOT of infamous things at GT.

    looking forward to another year of GT

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •