Can't connect to postgreSQL database through php pdo driver
Is your pg_hba.conf file all right? It's a known source of pain at the beginning w/ PostgreSQL. And, the situation you mention, is a good candidate for such kind of a problem. :-)
Comments
-
Parris Varney over 1 year
I've decided to switch from MySQL to PostgreSQL recently, mostly just to learn a new DB. It's been pretty painful, but I think I'm close.
I'm using php and PDO, my PDO driver has been successfully install and configured.
Opening my site, I get the error:
Connection failed: SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "postgres"
I'm using the following connection calls (I've tried a few variations of calling user/pw in the $dsn variable, and in separate $user/$pass variables, and including port=5432):
$dsn = 'pgsql:dbname=db1;host=localhost;user=postgres;password=pass'; $db = new PDO($dsn);
Also, I'm able to log into my db from the command line:
$ su postgres
(pass)
$ psql db1
output:
could not change directory to "/home/ec2-user" psql (8.4.9) Type "help" for help.
db1=#
Any ideas? I'd love to provide more info if needed.