Search Postgresql Archives

Re: php connection failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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








[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux