PHP Data Object support

DreamHost has quietly added support for the PHP Data Object (PDO) extension to their PHP5 installation.

PDO offers a lightweight, consistent interface for accessing databases in PHP. PDO provides a data-access abstraction layer, which means that, regardless of which database you’re using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn’t rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility (like ADODB or Pear DB).

This means that you use the same functions to connect and query a MySQL database and a SQLite database (the only databases currently supported by PDO at DreamHost). This allows developers to code without worrying about the seperate commands for each database.

A couple of tutorials to get you started:

The last two tutorials is about DB2 and Oracle, which is currently not supported by the PHP setup at DreamHost, but the tutorials has lots of info, and you can always compile your own PHP, if you need to use it.

4 Responses to “PHP Data Object support”

  1. Greg says:

    The other nice thing about having PDO at Dreamhost is that it gives the opportunity to try out the new database classes in the preview versions of the Zend Framework…at the current time their PDO drivers are the only ones that are close to stable (or working)

  2. Unofficial DreamHost Blog says:

    Good point Greg… Thanks!

  3. Jeff Carr says:

    It also gives you the chance to fairly seamlessly move over to a PostgreSQL at some point in the future hopefully… Sorry, I couldn’t resist. The lack of Postgres is the only thing holding me back from using Dreamhost for my commercial sites.

  4. G says:

    You say “DreamHost has quietly added support for the PHP Data Object (PDO) extension to their PHP5 installation”.
    It’s not that they decided to add it, it just is there in PHP >=5.1.0
    as even you said here: http://blog.dreamhosters.com/2006/03/17/php5-upgraded-to-512/
    “PDO extension is now enabled by default”

    :)