PDO Introduction | PHP DATA OBJECT | Lightweight and Consistent interface for accessing multiple databases in PHP

  • Avinash
  • 5
  • Aug 07, 2010
  • Web Development

PDO (PHP Data Object) is the lightweight and consistent interface for accessing the multiple databases (even of different types) through PHP.

PDO provides the data access abstraction layer, which means without worrying about the database type you can use the same functions for querying the databases.

PDO comes with PHP 5.1 and available as PECL extension for PHP 5.0, PDO requires the OO features in the core of the PHP, so it’s not compatible with the older version of the PHP.

No external libraries are needed to run this extension.

Installation:

For UNIX:

PDO and PDO_SQLITE drivers are enabled by default in PHP 5.1.0.

When installing PDO as the module, php.ini needs to be update so it loads the PDO extension when PHP runs.

Below line should comment out in order to load the PDO extension as a module.

extension=pdo.so
  extension=pdo.so

For Windows:

PDO and all major drivers come with PHP as a shared module and simply need to be activated by editing the php.ini

extension=php_pdo.dll
  extension=php_pdo.dll

Now next in order to enable other driver specific DLL files you can user either dll() to load dll files or you can simply enable it from php.ini file.

extension=php_pdo.dll extension=php_pdo_firebird.dll extension=php_pdo_informix.dll extension=php_pdo_mssql.dll extension=php_pdo_mysql.dll extension=php_pdo_oci.dll extension=php_pdo_oci8.dll extension=php_pdo_odbc.dll extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll
  extension=php_pdo.dll
  extension=php_pdo_firebird.dll
  extension=php_pdo_informix.dll
  extension=php_pdo_mssql.dll
  extension=php_pdo_mysql.dll
  extension=php_pdo_oci.dll
  extension=php_pdo_oci8.dll
  extension=php_pdo_odbc.dll
  extension=php_pdo_pgsql.dll
  extension=php_pdo_sqlite.dll

But be sure that these dll’s must me exists in the PHP extension directory.

Keep in touch for next updates related to PDO.

Source : PHP PDO

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: