Monday, October 3, 2011

Installing Drupal on Windows with PostGRESQL DB


I'm new to Drupal and I recently installed Drupal to work with Postgres database. As luck would have it, I hit a couple of configuration roadblocks along the way, which I'd call the most painful and uninteresting part of my IT career. So I thought I should summarize the steps in one place for future reference. I've a Windows 7 X64 installed in my laptop. 

The Downloads:

The system requirements for Drupal are given here. In short, download ApachePHP (download BOTH the installer and the zip version), Post GRE SQL.

The Configuration:

The step-by-step instruction to install Drupal is given here and it's fairly intuitive.

The Gotchas:

There were a couple of things to watch out for:

1. PHP looks for the config file (php.ini) in C:\Windows (or the equivalent windows folder) by default and that file isn't automagically created. So we need to add the PHP installation folder path to the PATH variable. In my case, I added C:\Program Files (x86)\PHP to the PATH variable.

2. Drupal uses PDO (PHP Data Objects) to connect to a database and you should be having a PDO (which is usually a DLL) for each DB you intend to support. However, this DLL is not provided in the PHP installer; and even if you go around hunting for that DLL file in Google, you will hit nothing but road blocks. So after you install PHP using the installer, unzip the contents of the PHP zip version that you downloaded (to a different folder of course) and copy the php_pdo_pgsql.dll file from the ext folder (under the extracted PHP folder) to the actual ext folder (created by the windows installer). Then, the php.ini file needs to be updated to include the following lines:
[PHP_PDO_PGSQL]
extension=php_pdo_pgsql.dll

Once this is done and the apache server is (re)started, following the step-by-step Drupal installation instructions should do the magic.

No comments: