P
P
pr0kazn1k2014-10-29 11:24:53
PostgreSQL
pr0kazn1k, 2014-10-29 11:24:53

How to connect to Postgresql in php?

As a result of the execution

$db = pg_connect("/* параметры для подключения */");

$stat = pg_connection_status($db);
if ($stat === PGSQL_CONNECTION_OK) {
  echo 'Статус соединения: доступно';
} else {
  echo 'Статус соединения: разорвано';
}

I get
PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: SSL error: wrong version number expected authentication request from server, but received S in /test.php
on line can't solve the problem :(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Entelis, 2014-10-29
@DmitriyEntelis

https://www.ruby-forum.com/topic/209605
There is an opinion that you are knocking on the wrong port where postgesql hangs

P
pr0kazn1k, 2014-10-29
@pr0kazn1k

Problem solved, set localhost instead of IP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question