Thread: FreeBSD/Postgres/Apache+PHP
Hello Postgres Community, Thank you guys very much for PostgreSQL. To me, its the best database management system under the sun. I am setting up anew jail configuration on FreeBSD with sockets and everything enabled. I can ping localhost fine. The problem is that whenI load a script that connects to the database, Postgres says Unable to connect to PostgreSQL server: FATAL: no pg_hba.confentry for host "x.x.x.x" (my actual web IP). I have done the following on the host machine: I'd like Apache/PHP to just connect to Postgres localhost, not via the jail's IP--thus, no change to pg_hba.conf is needed. If you guys have any suggestions it would be very much appreciated! PS. I mistakenly sent this email to pgsql-admin but I realize it should go to here (i think).
On Thu, Mar 31, 2011 at 12:21:33PM -0700, babak badaei wrote: > Hello Postgres Community, > > Thank you guys very much for PostgreSQL. To me, its the best database management system under the sun. I am setting upa new jail configuration on FreeBSD with sockets and everything enabled. I can ping localhost fine. The problem is thatwhen I load a script that connects to the database, Postgres says Unable to connect to PostgreSQL server: FATAL: no pg_hba.confentry for host "x.x.x.x" (my actual web IP). I have done the following on the host machine: > I'd like Apache/PHP to just connect to Postgres localhost, not via the jail's IP--thus, no change to pg_hba.conf is needed. what is your connection configuration in php? What's the host/port? Best regards, depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/
Hello. When you jail a process, all its attempt to bind to 127.0.0.1 address will be unsuccessful, and all its attempt to bind to * (all addresses) will be successful, but in fact it will bind only to jail's IP. So, when you try to connect to jail's pgsql from jail process will use jail's ip address as source and destination address. Alternatively, you can connect to unix socket (e.g. /tmp/.s.PGSQL.5432). For this you need to allow local access (something like that in pg_hba.conf): local db user md5 On 03/31/2011 23:21, babak badaei wrote: > The problem is that when I load a script that connects to the database, Postgres says Unable to connect to PostgreSQL server:FATAL: no pg_hba.conf entry for host "x.x.x.x" (my actual web IP). I have done the following on the host machine: > I'd like Apache/PHP to just connect to Postgres localhost, not via the jail's IP--thus, no change to pg_hba.conf is needed. > > If you guys have any suggestions it would be very much appreciated! -- С уважением, Александр Пыхалов, системный администратор ЮГИНФО ЮФУ.