keiusui has asked for the wisdom of the Perl Monks concerning the following question:

I already know perl pretty well, and I'm going to create an ecommerce site that utilizes MySQL databases. I know that php is more widely used to query MySQL databases, but I barely know php.

Would it be worth my while to learn php while I create my new website, or should I just stick to perl?

Replies are listed 'Best First'.
Re: mysql with perl or php
by Joost (Canon) on Nov 18, 2005 at 00:21 UTC
    The PHP built-in functions for accessing mysql are IMO just too messy and unportable (to other databases) to be really useful, though it does have a nicer layer called DB on PEAR.

    Anyway, using perl's DBI or PHP's DB should not make much difference in practice. Unless ofcourse you already know perl, in which case you should probably be using perl :-). DBI is one of the most tested and used CPAN libraries out there (especially in conjunction with its MySQL adapter DBD::mysql) so you don't need to worry about that.

    If you are interested in a higher level abstraction and you'd like an object-oriented interface, you can take a look at Class::DBI which is build on top of DBI and can be very useful. I'm sure PHP has something similar, but I haven't looked for it. Bottom line: if you know perl well enough, there is no reason to turn to PHP just for database support.

      I'm a proffesional PHP developer and at work we ditched PearDB because its buggy and slow and does placeholders in a very non-standard way. Offtopic so I won't elaborate but basically ... stick to Perl.

Re: mysql with perl or php
by marto (Cardinal) on Nov 18, 2005 at 00:10 UTC
    keiusui,

    If I where you I would create the site using Perl. Perl has Cpan and PHP is less secure... and so on.
    Dont take my word for it, perhaps you should do a Super Search (as this topic has been covered before), nodes like perl vs. php will provide you with a stack of information which would allow you to perhaps make an informed decision.

    Hope this helps.

    Martin
Re: mysql with perl or php
by pileofrogs (Priest) on Nov 18, 2005 at 00:28 UTC

    Are you looking for an excuse to learn PHP or are you trying to make a good web page as fast as you can? If the former, use php, if the latter use perl.

    Php is nifty, but it certainly isn't _better_ than perl for what you're trying to do, so just go with what you know. Unless the real goal is to get to know something new...

Re: mysql with perl or php
by xorl (Deacon) on Nov 23, 2005 at 19:33 UTC

    I ust both Perl (or is perl or PERL?) and PHP. For the task you have, PHP is better. For the most part its syntax is simlar to perl and where it differes it usually makes it simpler. If you're using Apache, php will be intergrated into the webserver instead of using the clunky cgi-bin directory. (You can use mod_perl and ePerl which I find to be almost as good as PHP, but there are more setup issues).

    Leave Perl for the really complex stuff behind the sceens. PHP is designed for putting databases on the web. It doesn't hurt to learn another language either.

A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.