Ruby on Rails and PHP are popular web application frameworks; both commonly make use of a database server on the back-end.
This article will cover installation of the packages needed to integrate PostgreSQL with Ruby on Rails and a standard PHP install.
PostgreSQL and Ruby on Rails
We only need to install a single package:
sudo aptitude install libpgsql-ruby1.8
Let's check if it's working properly:
irb ... irb(main):001:0> require 'postgres' => true irb(main):002:0> exit
Great! That's all you need to have Rails and PostgreSQL work together.
PostgreSQL and PHP
If you installed Apache and PHP using the Ubuntu Hardy - Apache and PHP article, then you only need to install the the PHP PostgreSQL module:
sudo aptitude install php5-pgsql
A standard phpinfo page shows the following information for the pgsql module:
As you can see, installation is very easy.
Installing the packages necessary for PostgreSQL to integrate with Ruby on Rails and PHP is a simple process — allowing you to concentrate on site design rather than the installation itself. A big plus!