it took me a couple of hours to figure this out so i figured i would post it here and maybe save somebody else a few minutes. comments welcome. thanks.
- install postgresql:
- give postgres user a password:
- enter ineractive terminal and create a user and db for your
application: (of course do not use tom and jerry!)
[code]sudo -u postgres psql -d template1
CREATE USER tom WITH PASSWORD ‘myPassword’;
CREATE DATABASE jerry;
GRANT ALL PRIVILEGES ON DATABASE jerry to tom;
– this should show your db now exists
SELECT datname FROM pg_database; [/code]
- now we need to load the postgresql extension
[code]cd /etc/php53/conf.d
sudo touch postgre.ini
sudo vi postgre.ini
click ‘i’ for insert and type the following:
click ‘:wq’
sudo /etc/init.d/httpd2 restart[/code]
- create a php file with the following in it. look at it with your
browser. if it says ‘1’ then you are ready to go! you can now use your previously created db and user in your app. ^^
[php]<?php
echo extension_loaded(‘pgsql’);
?>[/php]