Last updated October 16, 2014. Created on August 14, 2009.
Edited by rumblestrut, tz_earl, klauq, authentictech. Log in to edit this page.

PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases. This means developers can write portable code much easier. PDO is not an abstraction layer like PearDB. PDO is a more like a data access layer which uses a unified API (Application Programming Interface).

How to enable PDO

To enable PDO, configure --enable-pdo and --with-pdo-sqlite --with-pdo-mysql or whatever database needs supporting by PDO (see the PHP manual for more information).

Windows users

  • For Apache, you will need to make sure php_pdo.dll and php_pdo_mysql.dll exist in the php/ext directory, un-comment or add the appropriate lines in php.ini, and restart the web server.

    Under Windows, it may no longer be required to enable PDO when using newer versions of PHP, namely, PHP version 5.3 and later. This refers to php_pdo.dll. However, you still need to activate php_pdo_mysql.dll for MySQL or for whichever database you're using.

  • For IIS, PDO DLLs are not enabled by default. The preferred method for enabling them is to go to the Control Panel | Add/Remove Programs, highlight your PHP installation and click "Change" (Change/Remove - XP). Specify "FastCGI", then modify the installed extensions to include these two, then restart your server.

Macintosh users

Method 1

OS X 10.5: Detailed, step-by-step instructions are available here:

OS X 10.6: OS 10.6 comes with the PDO extension enabled by default. (For instructions on configuring your development environment, see:
Drupal 6 on OS X 10.6

Method 2

MAMP comes pre-configured with the PDO extension. For more information, see: HowTo: Create a local environment using MAMP.

Linux users

PDO is enabled by default as of php 5.1.0 on most linux systems. There is documentation to enable PDO for a mysql specific-driver.


As with most Linux systems, PDO support is present in PHP5 in all recent Ubuntu distributions, and certainly in PHP 5.2 which is required for Drupal 7. If you find that PDO support is not enabled, install the following packages and restart the server.

sudo apt-get install php5-common php5-mysql
sudo /etc/init.d/apache2 reload

Before restarting the server, make sure that and are being loaded, either in the php.ini file or in their own .ini files inside /etc/php5/conf.d.


If you find that PDO support is not enabled, do the following through SSH

yum update php-mysql
If bash tells you that pdo-mysql is not installed, then
yum install php-mysql

then restart your httpd/apache. When you try run the drupal installation script, you should be able to setup your MySQL database

Through WHM

  1. Go to Software > Easy Apache > Exhaustive Options List
  2. Select PDO and PDO MYSQL
  3. Save


Do not use the PECL PDO installer. The project is horribly outdated and abandoned. (See Cases have been reported where PECL PDO support seems enabled but it doesn't work correctly. One symptom was the inability to install Drupal 7.

If you have already installed PECL PDO, you will need to remove it and then reinstall the version from PHP core, or ask your hosting provider to do so.

On Debian and Ubuntu, the required commands are:

sudo pecl uninstall pdo_mysql
sudo pecl uninstall pdo
sudo apt-get install --reinstall php5-common php5-mysql
sudo /etc/init.d/apache2 reload

Looking for support? Visit the forums, or join #drupal-support in IRC.


netivajak’s picture

I found that after using WHM's Easy Apache the PDO drivers were not loading correctly and phpinfo showed "no value" for PDO drivers, and in another instance (different server) only showing sqlite. This was reflected by the install.php only giving the sqlite option.

Resolved by changing the order that the extensions are listed in the "Php Configuration Editor" (Advanced Mode) and ensure that is first. e.g.,,,

I've tested this by changing the order to e.g. and only .so files listed AFTER are enabled as expected. The version of WHM was 11.30.0 (build 19).

freescholar’s picture

I am on a host that has no access to the main php.ini file, but they do let you put one in your root dir. I added these lines and was able to have access to PDO and my Drupal install stopped crying!
short_open_tag = on

Give a Drupal

Alauddin’s picture

For those having issues with PDO on a virtualmin install, hope this helps.

make sure the .so files exits


update php.ini

; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/lib64/php/modules"

; Dynamic Extensions ;

It might also help to clean up your packages.
#package-cleanup --problems
#package-cleanup --dupes

my default install of Virtualmin also did not have php-xml that gave me .dom errors for d7 install.

#sudo yum install php-xml
#sudo service restart httpd