pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rob stone <floriparob@gmail.com>
To: ourdiaspora <ourdiaspora@protonmail.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: php connection failure
Date: Wed, 11 Aug 2021 23:10:40 +1000
Message-ID: <a3cfdab09af1012591a269028c77725606a4fe3f.camel@gmail.com> (raw)
In-Reply-To: <a5swJw18YHxKBbeDQzsYUFp5P3ni5PMgQQHm_zIDg7-9w3aEnIKNOTktT095fK-vennNx0Bpa_XVJO3Kzww01f20iAzSj4HsXh4uByEUfMI=@protonmail.com>
References: <rzszV54MMnHHEeW_3AqpkJKS_lMTEZUq_D6WR9JyfSMlgX76QeWjgy_H8YzslU2hvQef-XR2YBSNCMZS4CaJABdZp3uRR7FTU9MBqgLdEhw=@protonmail.com>
	<Zg_1LULyXJHutjLddDrqHhkIzu2OvGAiA9IPU6wyqgZpDOIuc4zjsqvwLCfoumyOHYlza3JH6yJ_VQWFtHK8eByyBm4pq-wHNONy9KSq144=@protonmail.com>
	<af141f45-c4e4-3468-fb7a-f587873c978e@aklaver.com>
	<ZV4khnVKWjnQRwgbKLOy30bqwjY1ZQs2j08fEc7wjHafd1rXOUTnuzGvBfcy4fAm0P7H6zOxCSgZAG0nyyEPvDRoLj93mm_hg_oHUtw7tr8=@protonmail.com>
	<a2724c54-be07-99cf-1ebc-2c978e0a5da7@aklaver.com>
	<tkUCMUw712K5m1iI6JdN31r7VnT4ZZYWXsFtsa5NsB5qN7SydCd8eFAtlXyyd5PRGkhxO8Kkso1lE1wEjFYPSfj-ewJcD0d0mPKyRRA8gkE=@protonmail.com>
	<79e859dc-9e70-cb72-85f8-e31786ad224d@aklaver.com>
	<VxhOLZOtHnK-tyKh98xh_FSWtJbq-1KrdeUK57clRIiKP6I0RcarycSViVspB2Ipynio1AepIuAAfxCM_hHkQNTEMjq4hmy3W6ce7JS2s3o=@protonmail.com>
	<5ae56ed6-ca48-b809-1e2d-85c36ca42f3e@aklaver.com>
	<a5swJw18YHxKBbeDQzsYUFp5P3ni5PMgQQHm_zIDg7-9w3aEnIKNOTktT095fK-vennNx0Bpa_XVJO3Kzww01f20iAzSj4HsXh4uByEUfMI=@protonmail.com>

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








view thread (36+ messages)  latest in thread

Message-ID: <a3cfdab09af1012591a269028c77725606a4fe3f.camel@gmail.com>
Permalink:  ../a3cfdab09af1012591a269028c77725606a4fe3f.camel@gmail.com/
Also on:    postgresql.org/message-id/a3cfdab09af1012591a269028c77725606a4fe3f.camel@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: floriparob@gmail.com, ourdiaspora@protonmail.com, adrian.klaver@aklaver.com
  Subject: Re: php connection failure
  In-Reply-To: <a3cfdab09af1012591a269028c77725606a4fe3f.camel@gmail.com>
  References: <rzszV54MMnHHEeW_3AqpkJKS_lMTEZUq_D6WR9JyfSMlgX76QeWjgy_H8YzslU2hvQef-XR2YBSNCMZS4CaJABdZp3uRR7FTU9MBqgLdEhw=@protonmail.com> <af141f45-c4e4-3468-fb7a-f587873c978e@aklaver.com> <ZV4khnVKWjnQRwgbKLOy30bqwjY1ZQs2j08fEc7wjHafd1rXOUTnuzGvBfcy4fAm0P7H6zOxCSgZAG0nyyEPvDRoLj93mm_hg_oHUtw7tr8=@protonmail.com> <a2724c54-be07-99cf-1ebc-2c978e0a5da7@aklaver.com> <tkUCMUw712K5m1iI6JdN31r7VnT4ZZYWXsFtsa5NsB5qN7SydCd8eFAtlXyyd5PRGkhxO8Kkso1lE1wEjFYPSfj-ewJcD0d0mPKyRRA8gkE=@protonmail.com> <79e859dc-9e70-cb72-85f8-e31786ad224d@aklaver.com> <VxhOLZOtHnK-tyKh98xh_FSWtJbq-1KrdeUK57clRIiKP6I0RcarycSViVspB2Ipynio1AepIuAAfxCM_hHkQNTEMjq4hmy3W6ce7JS2s3o=@protonmail.com> <5ae56ed6-ca48-b809-1e2d-85c36ca42f3e@aklaver.com> <a5swJw18YHxKBbeDQzsYUFp5P3ni5PMgQQHm_zIDg7-9w3aEnIKNOTktT095fK-vennNx0Bpa_XVJO3Kzww01f20iAzSj4HsXh4uByEUfMI=@protonmail.com> <a3cfdab09af1012591a269028c77725606a4fe3f.camel@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox