Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDo0Q-0005Iv-SP for pgsql-general@arkaria.postgresql.org; Wed, 11 Aug 2021 13:10:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mDo0P-0004K7-Ih for pgsql-general@arkaria.postgresql.org; Wed, 11 Aug 2021 13:10:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDo0P-0004Jz-5W for pgsql-general@lists.postgresql.org; Wed, 11 Aug 2021 13:10:49 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mDo0M-0005ZL-De for pgsql-general@lists.postgresql.org; Wed, 11 Aug 2021 13:10:48 +0000 Received: by mail-pj1-x102d.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so9464832pjr.1 for ; Wed, 11 Aug 2021 06:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=xXGNgDMMbnElPOjRZBn2lkQgt8aJnHYEPi7s9JKVt1U=; b=qwmAE8s7y0Doc1DhsDXRc/UItSSetf0u3Rcedpr71noijy2LfArCo79dgI+Nua5w+U V/+IEmkaaxPEeJpL8DTuX5vL/X6QnQErWgLVrxanlPqLk01YX6a+fwgPHhdwcn/tToWB cUIdqHfrAZrrLGEuIzasRHRAj0bfVIrY4qw1RHnYxhYZ9vq8g93j8lIEft+OgbOok+4Y aIHSAatCLgK2L5Gd3R3wyyR19GusQjPv3qHdeGLGCaAvnmmWUk9GlxtSoH+B2/HhNYU4 W0BPzksqed0wHZo7H394rJE0PVqegOGYgh7RdtUWjemQ7BDlDQqycjA801O+cibAxDI+ sNoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=xXGNgDMMbnElPOjRZBn2lkQgt8aJnHYEPi7s9JKVt1U=; b=f5qKtDrhNbtDeLVyuU3Y/pO+hFEzBcv1jnPVdgK7ztlFG32dQtNsxhoRCfOfEW4KYE mAhdV8O4/nFXDb4pFjALKv4tZ767ONeD5Fhug90cxlGP2AeLMtQUZMg4sYSZfllaE5/H CRIQrxtnkWdFKB8wIwHwDoGe+XNsUGyrUsVu6ufYQiKx4RnBmMz53uJ748U6r4PXZe2+ zr7aESS1YizQia/eEp5cDeBsVtmCIHVqQVYgXMSxEDRLK/7I13tR/P5NZOTTgAxh2cDD 9W4dHHgKiI5k2ISC0v7Lwiz0RB4VdO23UrZhnK0F8l0Sxil81Z5xQ5DFN8AeDkHTzeqL sIFQ== X-Gm-Message-State: AOAM5328ic7K8kJe+QfsI8LdNTOK2z+qZJsbtk/HIUF24vDTYpsvvayu 8xGSSs47qJjhs++Ulh8FWJc= X-Google-Smtp-Source: ABdhPJwWQr0xSaflNKOrtSZsdNfd9mQGqtFDZmJipqt/LYeuk74cJi/3eu/du3skjpVuCNBHY6oLUw== X-Received: by 2002:a17:90a:6e41:: with SMTP id s1mr10698875pjm.109.1628687444929; Wed, 11 Aug 2021 06:10:44 -0700 (PDT) Received: from 192-168-1-114.tpgi.com.au ([202.125.18.232]) by smtp.gmail.com with ESMTPSA id i8sm28304625pfo.117.2021.08.11.06.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 06:10:44 -0700 (PDT) Message-ID: Subject: Re: php connection failure From: rob stone To: ourdiaspora , Adrian Klaver Cc: "pgsql-general@lists.postgresql.org" Date: Wed, 11 Aug 2021 23:10:40 +1000 In-Reply-To: References: <79e859dc-9e70-cb72-85f8-e31786ad224d@aklaver.com> <5ae56ed6-ca48-b809-1e2d-85c36ca42f3e@aklaver.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: > > " > >          >                 Generic CPAC database >          >          >                                          $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'; >      } >                 ?> >          > > " > 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