Re: [Phplib-users] unable to connect to pgsql server
Brought to you by:
nhruby,
richardarcher
From: Frank B. <fb...@sy...> - 2004-05-27 16:57:05
|
I think the error with Unix domain socket is because apache is running chroot /var/www - a change in default installation sometime between OpenBSD 2.9 and 3.5 - could this also be causing the problem with tcpip socket? I have found that $host="127.0.0.1" works, but $host='localhost" still does not. At 08:56 PM 5/24/04, Frank Bax wrote: >With $Host="" the error message changes to: > >PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could >not connect to server: No such file or directory > Is the server running locally and accepting > connections on Unix domain socket "/tmp/.s.PGSQL.5432"? > in /php/class/phplib-7.4/db_pgsql.inc on line 51 > >I had '-i' in startup script, but I even tried removing that in favour of > tcpip_socket = true >in /var/pgsql/data/postgresql.conf >But that didn't change anything. Is there another way to confirm this >functionality is indeed configured correcly? When I start command-line >interface with: > psql -h /tmp >It works fine - 'man psql' seems to indicate this confirms unix domain >socket is working? These also work: > psql -h localhost > psql -h 127.0.0.1 > >Frank > > >At 04:29 PM 5/24/04, Clark Freifeld wrote: >>I think this may be because PHP is attempting to connect to Postgres via >>an IP socket (even though they are on the same host) and Postgres is only >>accepting Unix socket connections, or vice-versa. In your local4.inc, try >>putting >> >>var $Host = ""; >> >>instead of "localhost" in the connection config for your database class >>and see if that works. I use Postgres and that's what I do and it works >>for me. >> >>I remember reading something about this in the Postgres docs but I don't >>recall exactly how it works. I think if you configure Postgres to accept >>IP connections, putting "localhost" for your $Host will work. >> >>Hope that helps. >> >>Clark >> >>On Sun, 23 May 2004, Frank Bax wrote: >> >> > I am currently running phplib 7.4 on OpenBSD 2.9 / PHP 4.0.4pl1 / >> pgsql 7.1 >> > I have created a new system on OpenBSD 3.5 / PHP 4.3.5RC3 / pgsql 7.3.5 >> > I start pgsql with: >> > su -l _pgsql -c "/usr/local/bin/pg_ctl start \ >> > -D /var/pgsql/data -l /var/pgsql/logfile.`date >> +\%Y\%m\%d` \ >> > -o '-i -B 512 -D /var/pgsql/data'" >> > I copied an existing database and php application to the new box for >> > testing, but when I try to access the application webpage, I get the >> > following message in apache error log: >> > PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: >> unknown >> > host name: localhost in /php/class/phplib-7.4/db_pgsql.inc on line 51 >> > >> > I'm not sure what step I might have missed during setup of the new system. |