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:
- First steps with PDO by Wez Furlong, developer of the extension
- Introduction to PDO (PowerPoint) by Ilia Alshanetsky, PHP developer
- Introduction to PHP 5 PDO at Sitepoint (Furlong’s comments)
- Connect PHP to DB2 and Cloudscape via PDO by Wez Furlong
- The PHP Data Object Abstraction Layer and Oracle by Wez Furlong
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.
April 6th, 2006 at 07:54
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)
April 6th, 2006 at 11:47
Good point Greg… Thanks!
April 10th, 2006 at 13:54
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.
May 11th, 2006 at 23:29
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”