Thanks John, I tried that and it works but with some changes I made. After the changes you suggested I was still getting the same message: Warning: pg_pconnect() [function.pg-pconnect]: Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? Anyway I managed to connect to localhost, but after I made changes to pg_connect and I removed the host name FROM 1. pg_pconnect("host=localhost dbname=mydb user=myuser password=mypassword"); TO 1. pg_pconnect("dbname=mydb user=myuser password=mypassword"); Now it works, but VERY SLOWER than before. One of the scripts I'm running on the previous host took below 2 sec for 1000 entries and now it takes 1 sec for 100 entries. working pg_hba.conf looks like this: 1. # IPv4 local connections: 2. local all all trust 3. local all my_user ident sameuser 4. local my_db my_user password 5. host my_db my_user 0.0.0.0/0 password 6. # IPv6 local connections: 7. host all all 127.0.0.1/32 ident sameuser 8. host all all ::1/128 ident sameuser -----Original Message----- From: John R Pierce [mailto:pierce@xxxxxxxxxxxx] Sent: Monday, March 16, 2009 2:25 AM To: Kostadin Solakov Cc: pgsql-general@xxxxxxxxxxxxxx Subject: Re: PostgreSQL on Webmin 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@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general