INSTALLATION: PostgreSQL is not showing up as option under database configuration

netdawg's picture
  1. Web Server: apache 2.2.22 on Windows
  2. Using php as apache module version 5.3.13
  3. PostgresSQL 9.0 is FULLY functional with other PHP applications.

Installed Drupal 7 - and started configuration with


go through all steps with no errors until "Database configuration" under which I see only two options:

  1. MySQL, MariaDB or equivalent
  2. SQLlite

As mentioned PostgreSQL is working just fine. So, the solution in

is not applicable - since it advises to simply install php-pgsql - which is just a matter of pointing to the extensions directory under windows.

Then tried the direct connection recommended in

This leads to the dreaded "Drupal already installed" twilight zone. When you try update, you get weird errors like "need PDO etc" which has been deprecated long ago,


There are two PostgreSQL

Josh Waihi's picture

There are two PostgreSQL extensions in PHP. One is called pgsql which is the old version. Drupal 6 runs on this. The other is pdo_pgsql. Drupal 7 requires this.

This is what you'll need to have enabled to make PostgreSQL an available option to use when installing Drupal.

YES - that did it - BASICALLY

netdawg's picture

For some reason php_pdo_pgsql.dll was NOT in the ext directory with by PHP installation (Windows Installer). However, it is available in the binary zip file. That was it.

Put into the ext directory and included it. Now only PostgreSQL shows up and not MySQL, SQLlite etc. Just the way I wanted.

PDO, PostGreSQL etc can be confirmed by doing phpinfo()

However, it is important to note that there appears to be an IMPLICIT Load File of libpq.dll from within c:\php directory. Even in the latest version of php (5.4.7) this is apparently at PostGreSQL 8..3.3 wheras my PostGreSQL version is 9+. To fix this you may want to experiment with:

  1. Using LoadFile %POSTGRES_HOME%/bin/libpq.dll in Apache conf, OR
  2. Copy over the ancient libpql.dll within PHP with PostGreSQL distribution.

Lastly, and this is just a warning - just my experience - all OTHER php apps - besides Drupal - using legacy "pg_connect" will fail after activating PDO. This pretty much ensures (for me) to have a dedicated apache instance for Drupal - probably for the best anyway.

probably your enviornment

metzlerd's picture

I have been connecting to Posgres 9.x databeses with the 8..3 php drivers for years without trouble. You do not need and 9.x client to connect to a 9.x database.

I also have code in drupal instances that connects both with PDO annd pg_connect side by side, so you still have an environment problem if you're getting this behavior. You can and should have both the PDO and the normal Postgres drivers installed if you want to connect with both devices.


Balanga's picture


I am attempting to install Drupal with Postgresql under Apache running on FreeBSD.

In my search for help in getting this setup I came across this group which I have just joined.

Can anyone point me to any guide for making this work?

Or should I just accept the default MySQL configuration?

You'll need to first get PHP

Liam Morland's picture

You'll need to first get PHP and Postgres talking to each other. You probably need to install the Postgres module in PHP. Once that is working, Drupal should work.

Installing Drupal

Balanga's picture

I have phpPgAdmin installed and I decided to try and get Drupal 8 installed because it specifically includes an INSTALL.pgsql.txt whereas I don't think Drupal 7 even mentioned Postgresql.

But when running install.php I get to 'Set up database' and am not sure whether the install script should be able to setup the database - Database type does not explicitly mention Postgresql so I don't know if it is included.

As a Postgresql user, should I avoid running install.php?

No, you should always run install.php

mradcliffe's picture

No, you should always use install.php to install on PostgreSQL (since Drupal 7).

If you do not see PostgreSQL explicitly listed as a database type, then PHP PDO has not been configured with PostgreSQL support per \PDO::getAvailableDrivers());.

It's possible that phpPgAdmin uses the older pg_* functions in PHP. Drupal relies on PDO support instead of using mysql/mysqli/pg_ functions as it is more secure.

PHP info

Balanga's picture

AFAICT I have php set up correctly - maybe you could check

I do not see a pdo_pgsql

DarcyB's picture

I do not see a pdo_pgsql listed, so like was mentioned earlier, you will need to install that first. Form there it should just work.