Knowledgebase

PostgreSQL Connections

If your having trouble making a connection to a PostgreSQL database, read on:

The reason your database connection may have failed was because you had specified host=localhost in the connection string. PostgreSQL databases are not configured to accept connections via tcp/ip, so specifying a host causes the connection to fail. If the host and port number are left out of the connection string, the the connection is made locally via UNIX sockets, which does allow the connection.

If your database connection string reads: host=127.0.0.1 username=xxx password=yyy dbname=zzz This should just be: username=xxx password=yyy dbname=zzz

Not accepting tcp/ip connection is the default behaviour for a postgres install.
This should now allow your php script to connect to the PostgreSQL database.

  • 2 Users Found This Useful

Was this answer helpful?

Related Articles

User access to phpMyAdmin

Can I set up phpMyAdmin so that a user has to login with a username and password and then only...

Remote database connections

Problem:Rather than use phpAdmin, I use a Windows GUI package (mysqlcc) to connect to my MySQL...

phpMyAdmin error message

When using phpMyAdmin you may notice that when you log out using the "exit" button you get the...

Mysql stored procedures

If you are wanting to use Mysql stored procedures, currently this is not suppported at the moment...