Re: php connection failure

Поиск
Список
Период
Сортировка
От rob stone
Тема Re: php connection failure
Дата
Msg-id a3cfdab09af1012591a269028c77725606a4fe3f.camel@gmail.com
обсуждение исходный текст
Ответ на Re: php connection failure  (ourdiaspora <ourdiaspora@protonmail.com>)
Ответы Re: php connection failure  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: php connection failure  (ourdiaspora <ourdiaspora@protonmail.com>)
Список pgsql-general
Hello,

On Wed, 2021-08-11 at 11:09 +0000, ourdiaspora wrote:
> 
> 
> The connection to postgresql seems OK now (thank you), but the php
> web page continues to fail to connect to the database:
> 
> "
> <html>
>         <head>
>                 Generic CPAC database
>         </head>
>         <body>
>                 <?php
>                         $dbconn = pg_connect("dbname=cpacweb
> user=cpaca host=localhost") or die("Could not connect");
>                         $stat = pg_connection_status($dbconn);
>      if ($stat === PGSQL_CONNECTION_OK) {
>          echo 'Connection status ok';
>      } else {
>          echo 'Connection status bad';
>      }
>                 ?>
>         </body>
> </html>
> "
> Returns:
> 
> "
> Generic CPAC database Could not connect
> "
> 

I don't know which version of PHP you are running, but can you re-write
the call to pg_connect as a try . . . catch block so that the exact
error message is returned instead of just a "die"?

Are you sure postgres is configured to use port 5432? There is no
PGPORT environment variable set?

Why are you starting postgres with a -c option and no parameters
following?

I assume you know that version 9.6 of postgres is nearly at EoL.


HTH,
Rob






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

Предыдущее
От: "Daniel Verite"
Дата:
Сообщение: Re: JWT decoder
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Getting pg_stat_database data takes significant time