Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

PHP vs. Perl for the 10,000th time

by kha0z (Scribe)
on Jul 27, 2001 at 15:11 UTC ( [id://100272]=perlmeditation: print w/replies, xml ) Need Help??

It seems that my last general question of PHP vs. Perl was not too popular for its general nature on topic that has been beat to death. However, I feel like bring adventureous again.

For fun, I decided to do a personal project of mine with php. It seems to me that on the surface php offeres some nice features like DB connectivity and cookie handling that is intuitive to the language. From this stand point doing dynamic pages with a php, mysql, and xml is in fact quicker and cleaner than attempting to do the same with Perl. For the sake of brevity, my reasoning for this was due to the general lack of system administrators help in compiling some modules that I needed such as DB drivers and XML modules. I also found problems compiling the modules on my system and them transferring them over to the where the site was hosted. Last but not least there is the quota issue of having to house my modules on my disk space since the sysadmin would not comply with my requests to have certain obscure modules installed.

From experience it seemed like a smart move to convert my project to php. Now, hypothetically speaking, if I was to host my own site. I think that a mixture of a php front end and mysql back end seems to be easier and cleaner to do from this last projects experience. However, I am guessing that I could benefit from running perl scripts in my crom tab for DB clean up and perhaps some other web applications that do not require a user interface and can be used in the backend. For example, banner tracking, clicks, redirects and the like.

I am not one to contend that PHP is a better language than Perl. For one there is no comparision with the robustness of Perl in comparison with PHP. However, IMHO, for general CGI programming it seems clear to me that PHP seems to be the better choice (at least for front end development).

Is this the consesus that is found amongst CGI developers? If so, why is it the consensus? If not, where can I find information or discussions justifying the stance of the developer on which language is better for CGI development?

Good Hunting,
kha0z

Replies are listed 'Best First'.
Re: PHP vs. Perl for the 10,000th time
by arhuman (Vicar) on Jul 27, 2001 at 16:25 UTC
    I use both PHP and Perl at the office.
    To be honnest PHP almost match Perl in my humble opinion (of a perl zealot ;-) :

    We recently talked about it on the Parisian mongueurs mailing list.
    • PHP offers quite the same functionnalites as Perl.
    • PHP provides a clean separation from the code and the presentation (via the template mechianism)
      like perl (Via HTML::Template, AxKit...)
    • PHP offers a good Database connectivity even if I personnally find DBI more powerful and more clean
      (read: higher level) than the native PHP function (mysql_xxx,postgres_xxx)
    • PHP is at least as fast as perl (see these benchs or those one)

    The only things that keep me prefering Perl is the regex engine, the security features (taint checking, use strict...)
    and the FUN I have coding in Perl !!! ;-)
    But it's rather a matter of personnal taste and nothing I could use as an argument in a professionnal situation.

    "Only Bad Coders Code Badly In Perl" (OBC2BIP)
Re: PHP vs. Perl for the 10,000th time
by synapse0 (Pilgrim) on Jul 27, 2001 at 16:37 UTC
    Well, in dealing with PHP versus Perl for CGI, there is always that one BIG issue called security. Generally, the way the latest builds of PHP have gone, you have less control over security dealing with PHP than you do with Perl on systems where you don't have access to configure the php module/executable. If you did have such accesses, then you wouldn't normally have much of a problem getting the Perl modules in that you need. PHP is quick, and is coming along fine in a timeline relational way. Perl is much more mature than PHP.. But PHP is almost purely web based, and there are much more reasons to use Perl than for the web. If you can get a host that deals well with securing PHP, then I'd say that, if you're comfortable with the language (many ppl like it cause it's more strict than Perl's freeform on a syntax level, which can lead to overload when there's several thousand ways to do something in Perl) then PHP can be a better choice. I have started playing with PHP and it does tend to be easier to develop the front end, but right now there are several security issues with the default config of PHP that many hosts tend to use. Aside from the security tho, PHP is nice on a front end level, using Perl for several backend tasks. The two languages can live in harmony and can compliment each other well... But I still tend to lean towards Perl for more hardcore tasks. No, I'm not a professional developer, but that's my tendency so far, and I don't see it changing unless I'm paid to work with PHP..
    anyway.. my 2 pence..
    -Syn0

    Update: Oh, damn... I forgot the most important reason why Perl kicks ass all over PHP.. thanks to John's post, I remebered.. there is no PHP community in comparison to Perl.. the Perl community is one of the most sharing, strong prescences I've ever seen. It continues to inspire my fierce loyalty and I just had to mention that as well.. PHP has a ways to go for this kind of thing.
Re: PHP vs. Perl for the 10,000th time
by MZSanford (Curate) on Jul 27, 2001 at 15:29 UTC
    <humble><opinion>
       I will start off by saying i have done very little with PHP, but from what i have seen it is very good for CGI, but i have yet to see it used for non-CGI programming. This makes me wonder, am i the only non-CGI Perl programmer ? Do others not have batch processes ? hmmm ... i would wonder.
       Let us not forget, that while Perl is good for CGI, there was perl prior to CGI.pm, and it's uses span farther. I think the right tool for the job is always important, and sometimes i guess perl is a bit much (so, no need to load the perl interpreter to move one file from cron, shell might be better). If PHP is quicker for CGI, i do not contsest, but remember that the power of a language can come in handy during the scaling times. So, in short, i am sure people will argue this until they are a nice shade of maroon, and this will become a post as long as the Amazon, but if PHP is a better tool for the job, use it, but be mindfull (always) of the flexability of the solutions chosen.
    </opinion></humble>
    Thus spake the Master Programmer:
    "When you have learned to snatch the error code from the trap frame, it will be time for you to leave."
    -- The Tao of Programming
      Don't worry, you are not the only one who uses perl for non-CGI programming. I mean, I use perl to maintain and support ADA, so beat that :)

      In response to your comments about PHP not being used for much other than CGI you are correct. PHP developers and advocates say that you can use it for non-CGI programming, and I have seen examples of this, but it has not caught on. Why? I'm not sure, I think it may be because that for non web applications, most people prefer perl, *sh, or python. Another reason why PHP is not used for non web applications is that perl is much superior in that respect. The reasons are CPAN, and a less focused language. PHP was developed mainly for web programming, while perl was developed for... um.... well, because Larry Wall was lazy I guess, which led to the wonderful world of CPAN and modules.

      Also, in response to the main node:

      Another thing to think about in your choice of a language for web development is security. Some of the basic, default behavior of PHP is(was) a security problem. I don't have any specific evidence at the moment, but I know there were several big security issues regarding PHP. These issues don't apply to well designed sites, but were very easy for beginners to make.

      I'm not saying that perl is better than PHP, or that PHP shouldn't be used, I'm just saying use whichever language suits your needs, and you feel more comfortable to use for programming a secure environment

      --xPhase

Re: PHP vs. Perl for the 10,000th time
by princepawn (Parson) on Jul 27, 2001 at 21:21 UTC
    PHP provides a clean separation from the code and the presentation (via the template mechianism)

    Is PHP only for HTML? Or can it generate WML, printable pages or PDF pages from the same content? Apache::PageKit can do so.

    And how good is it at language localization?

      Seperation of code and presentation is just as clean as in perl, I'm really not sure why people bring that up as a point for PHP... Templates slow things down, and I think Perl actually has the advantage when using templates (because of it's innate ability for text manipulation and regex). PHP can generate PDF, I'm pretty sure it can do WML, as well as some other page types. It also has the ability for graphics manipulation...
      Language localization?
      -Syn0

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://100272]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-03-28 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found