PECL extensions and me?

So, after attending Sara Golemon, Wez Furlong, and Marcus Boerger‘s talk on Extending PHP at ZendCon 2007, I’m inspired to do something with PECL extensions. That is, takeover maintenance of one, or write one from the ground up.

I spent the entire flight home “porting” (if you can call it that!) some things from our Schematic library to “extensions.” That is, I wrote some basic methods in a class…and it compiled! And it worked from Userland code, too!

So, is there anything you’re dying to see made into a PHP extension? Tired of calling that command line program to do that super cool, whizz bang thing you always do? Or, tired of your favorite extension sucking horribly, wishing someone would show it some love?

If so, let me know! I’m looking for some inspiration here, ’cause I’m not finding it just yet. Perhaps a blog post will help…for the two of you that read this thing. :)

PDO’s ATTR_PERSISTENT attribute

If you’ve ever used PDO and want to use persistent connections, here’s a tip:

You must set PDO::ATTR_PERSISTENT => true in the array of options you pass to the PDO constructor!

If you call $pdo->setAttribute(PDO::ATTR_PERSISTENT, true) after the instantiation of the object, you won’t be using persistent connections.

To illustrate, here’s the correct way to use it:

$pdo = new PDO(
    'oci:dbname=foo',
    'username',
    'password',
    array(PDO::ATTR_PERSISTENT => true));

Now, this makes perfect sense, but it’s not specifically called out in documentation. Granted, yes, the example here shows it being used in the constructor, but setAttribute() isn’t too chatty if you violate the unwritten “rules” of PDO. Only once you dig into the source code will you be able to figure this out (by virtue of the fact that the ATTR_PERSISTENT handling is only performed in the ctor!).

It’d be nice of PDO::setAttribute() raised a warning if you try to set PDO::ATTR_PERSISTENT, by the way. Maybe I’ll submit a patch or something.

Oh, also, if you’re using persistent connections, you can’t use a custom PDOStatement class. That was the nail in the coffin for us as we’re using a custom statement class. Somehow I think this may be fixable, though…sure would be nice.

Anyways, I still love you, PDO, but not as much as I did. Goodbye PDO (for now), hello oci8 with a wrapper class mimicking the PDO interface!

Behold…the PHPumpkin!

When my wife and I decided we wanted to carve pumpkins this year, I figured I’d try my hand at something a little more intricate…the PHPumpkin!

Yes, that’s the PHP logo carved into a pumpkin. About two hours of hard work by yours truly, Brian DeShong.

More photos here!

ZendCon 07: “The Grown-Up Company’s Guide to Development”

On October 10, 2007, I spoke at the Zend PHP Conference on “The Grown-Up Company’s Guide to Development”. This particular talk focused on the introduction of coding standards and code reviews, along with using development tools and adopting a framework/toolkit and writing your own toolkit.

Grab a PDF of the slides

ZendCon 07: “Mobilizing and Sharing: How Zend Framework Builds Community for Nokia MOSH”

On October 9, 2007, Ben Ramsey and I spoke on how we used Zend Framework in building Nokia MOSH at Schematic. I also touched on some of the architectural details as well.

The talk went great! A link to a PDF of the slides is below:

Grab a PDF of the slides

WordPress Themes