Kostadin Solakov wrote:

Hi there!

I just installed Webmin on my dedicated server and I really had hard time making all configuration that were needed to migrate my site. Anyway, now everything is working except for one thing. I can’t connect to the database through PHP. Remote connection is working fine, but local doesn’t.

The connection string looks like this:

pg_connect('host=localhost port=5432 user=user password=pass dbname=db')

I made the necessary changes in postgresql.conf

listen_addresses = '*'

port=5432

And I added this in pg_nba.conf:

local all all trust

local all user ident sameuser

local db user password

But still I cannot connect using php. The connection file is the same as it was on my previous host (shared one) so it’s supposed to be working.

I created the same database and user.



the first local all all takes precedence as that matches any local (domain socket) connections. as is, you're saying any process running your server can connect to any database as any user with no authorization required.

however, none of those lines affect localhost IP connections, those instead would match a `host .... 127.0.0.1/32 ....`



I most typically use the following...

local all all ident sameuser # allow local domain connections to authenticate only as themselves host all all 127.0.0.1/32 md5 # allow localhost IP connections to authenticate with passwords only

and sometimes...

host all all my.ip.sub.net/24 md5 # allow any user on my IP subnet to authneticate with passwords




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to