Posts Tagged ‘postgres’

FATAL: no pg_hba.conf entry for host ::1

Thursday, October 11th, 2012 | Life, Tech

If you’re getting an error trying to connect to Postgres on localhost, the problem is probably that your system is configured for ipv6 but your Postgres isn’t. You can change this however.

First off, you need to find the pg_hba.conf file.

locate pg_hba.conf

Edit it and find the line which defines the localhost.

hosts  all all   md5

Below it, add the following line.

host all all ::1/128 trust

Finally, restart Postgres.

Installing Postgres PDO driver on cPanel

Friday, October 5th, 2012 | Life, Tech

cPanel offers two options for installing PDO – using EasyApache which can enable PDO and MySQL’s PDO driver or installing everything via PECL. Unfortunately, under PHP 5.3, the PECL installers don’t work, so if you need any other PDO drivers, you’re in a hole.

Luckily, you can install it manually.

Download the PDO driver from the PECL website. Extract the archive and CD into the directory.

wget http://pecl.php.net/get/PDO_PGSQL
tar -xzf PDO-PGSQL-1.0.2.tgz
cd PDO-PSQL-1.0.2/

Once this is done, run the standard commands for building a PHP extension.

phpize
./configure
make
make install

Once this is done, you can add the extension to php.ini.

cd /usr/local/lib/
vim php.ini
extension=pdo_pgsql.so

Finally, restart Apache and the Postgres driver should show up in your phpinfo() output.