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

Monks,
I have long been searching for a free (I'm a poor 15 year old) web host that supports both Perl and a database, preferably MySQL. I have come close, but have found a stumbling point. The site supports Perl and MySQL, but not together! They say this is because of performance issues

My question is this: is Perl much slower than PHP in databases? I would love to be able to work with Perl and MySQL, but unfortunately my budget's limited/non-existant. Can anyone testify to their performance issues or give a good link? Maybe if they're wrong they will begin to support it. Or does anyone know of a free host that supports Perl and MySQL? (This may not matter if jcwren ends up providing hosting, but it'd still be good to know)

- p u n k k i d
"Reality is merely an illusion, albeit a very persistent one." -Albert Einstein

Replies are listed 'Best First'.
Re: Perl vs. PHP: databases
by Anonymous Monk on May 05, 2001 at 09:40 UTC
    I ran into the exactly same situtation with my web site. However, it's possible (albiet nonoptimal) to get MySQL access in Perl via PHP...in sql.php:
    <?php // This is a hack to get around F2S's limitation of only allowing PHP- +MySQL $connect = mysql_connect("db.account.f2s.com:3306", "account", "passwo +rd") or die(mysql_error()); $result = mysql_db_query("account", $query, $connect); while($row = mysql_fetch_array($result)) { echo "{\n"; while(list ($key, $value) = each($row)) { echo "\t$key => q[$value],\n"; } echo "},\n"; } ?>
    Then in your Perl program:
    sub sql_query { my ($query) = @_; my ($data_structure, @data); # Ugly kluge to get SQL to work via Perl instead of PHP $query = url_encode($query); # TODO: use standard function $data_structure = get("http://www.account.f2s.com/sql.php?query=$q +uery"); @data = eval "($data_structure)"; return @data; }
    Hope this helps..oh and by the way, I believe Spaceports.com supports Perl and MySQL, though you have to request it (I requested a CGI account but they never received one, maybe you'll have more luck.)
Re: Perl vs. PHP: databases
by tune (Curate) on May 05, 2001 at 09:00 UTC
    Perl is competitive with PHP's performance if mod_perl is setup. PHP has a very big advantage called mysql_pconnect(), which uses persistent database connections. In a high traffic site it is boosting up performance significantly. You can set up Apache::DBI and mod_perl, and use persistent connections, if you rule that machine. Probably you cannot convince them to do that.

    --
    tune

Re: Perl vs. PHP: databases
by stuffy (Monk) on May 05, 2001 at 07:27 UTC
    I believe that HTTP://www.marmoset.net supports perl and mysql. I haven't been at their site in a while. I know that they will give you sql access if you ask for it. I also know that they use allow perl (or did when I had a site there) They are bigger on PHP though. Check it out, it might be what you are looking for.
Re: Perl vs. PHP: databases
by DrZaius (Monk) on May 05, 2001 at 19:57 UTC
    Hmm, I've never heard this before. Perhaps that is because I am about as anti-php as anyone can be.

    So, you get a huge performance boost because of connection caching? Is it caching, or multiplexing?

    The one problem I've run into before with connection caching is that it tends to keep the connections open. Why is this bad, you ask? Well, every open connection to the database requires resources (mainly memory space). So if your website gets a hard hit, the first few accesses are going to be fast, but you will reach your performance ceiling very quickly.

    Also, why would you want to use a programming language that requires a different api for different databases? With perl, it doesn't matter what back end you use, you always get all of DBI's functionality and utility methods.

    I would tend to think that php tends to dictate the database backend you use. Just imagine: "We wanted to use <your database software here>, but the interface in php sucks compared to mysql, so we have to use less robust backend software."

Re: Perl vs. PHP: databases
by joee (Beadle) on May 08, 2001 at 04:29 UTC
    I'd check out xoasis. They offer MySQL but unknown if it works with Perl or just PHP.