Re: PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server:

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server:
Дата
Msg-id 48283742.2080204@wildenhain.de
обсуждение исходный текст
Ответ на PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server:  (Abdus Samad Ansari <ansarias@wbpcb.gov.in>)
Ответы Re: PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server:
Список pgsql-general
Hi,

Abdus Samad Ansari wrote:
> PHP Warning:  pg_connect(): Unable to connect to PostgreSQL server:
> could not connect to server:
> I have setup PHP/Postgres and is running fine upto document root
> i.e. /var/www/html, but when i am calling it through a cgi-bin php file
> it is giving log error as :
> [error] [client 127.0.0.1] PHP Warning:  pg_connect(): Unable to connect
> to PostgreSQL server: could not connect to server: \x04\xe6\xe3\xbfPF;
>
well there are a couple of checks you could do to find out:

1) decide how to connect - via IP or via unix socket
2) in each of the above see if postmaster is indeed listening to that
    socket (netstat is your friend)
    - adjust postgresql.conf and/or start options accordingly.
    depending on your distribution you might want to enable logging
3) try connection via psql command line client
    - see if you have matching pg_hba.conf entries
4) try to connect via psql command line client with the same user your
    script runs (apache in your case)
    - same as (3) but ident vs. md5 (password) in pg_hba.conf

after all you might want to use some pooling layer because pg_connect
from cgi can get very expensive (also note that outside of PHP there
are a lot possible elegant solutions to that)

Tino

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Abdus Samad Ansari
Дата:
Сообщение: PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server:
Следующее
От: "Harald Armin Massa"
Дата:
Сообщение: Re: PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: