[olug] PHP vs. Perl

Sam Tetherow tetherow at nol.org
Wed Nov 27 17:29:23 UTC 2002


If speed is an issue I would strongly suggest using mod_perl with 
Apache::DBI you get DB connection pooling, as well as the benefit on 
persistant scripts which means no compile time on the perl code.

Joe Catanzaro wrote:
> And that's exactly what I'm doing with Perl. Setting the MIME header and 
> streaming the data and this works very well. Would there be an advantage 
> to moving to PHP? Faster, easier to code?
> 
> sub display_image
> {
> my ($name, $size) = @_;
> my $col_name = (defined ($size) ? $size : "image");
> my ($dbh, $mime_type, $data);
>         $dbh = WebDB::connect ();
>         ($mime_type, $data) = $dbh->selectrow_array (
>                 "SELECT mime_type, $col_name FROM image WHERE name = ?", 
> undef, $name);
>         $dbh->disconnect ();
>         error ("Cannot find image named $name") unless defined ($mime_type);
>         print header (-type => $mime_type, -Content_Length => length 
> ($data)),
>                         $data;
> }
>

<!--- SNIP --->

> Joe Catanzaro
> joecatanzaro at cox.net
> 




More information about the OLUG mailing list