postgresql connection failure

[email protected] (ourdiaspora)
Newsgroups php.general
Message-ID <sw4lxJFQaUtIqrTT_JX6yTpssooS6A_Gy8k-JZYaOscplpihrFb_9FLW6AzugRA7Qf29taTSQ9m6khJqKmnJzIcS-qq6U5jfPmwU-oQbzqs=@protonmail.com>
Readers,

After a day and half trying and failing, time to ask! :)

Command terminal:

sudo psql -d cpacweb -h localhost -U cpaca

psql: FATAL: no pg_hba.conf entry for host "::1", user "cpaca", database "cpacweb", SSL on

FATAL: no pg_hba.conf entry for host "::1", user "cpaca", database "cpacweb", SSL off

SHOW hba_file;

/etc/postgresql/9.6/main/pg_hba.conf

sudo nano /etc/postgresql/9.6/main/pg_hba.conf

local all postgres peer

TYPE DATABASE USER ADDRESS METHOD
=================================

"local" is for Unix domain socket connections only
==================================================

local all all peer

IPv4 local connections:
=======================

host all all 127.0.0.1/32 md5

IPv6 local connections:
=======================

host all all ::1/128 md5

Allow replication connections from localhost, by a user with the
================================================================

replication privilege.
======================

#local replication postgres peer

#host replication postgres 127.0.0.1/32 md5

#host replication postgres ::1/128 md5

local cpacweb cpaca ::1/128 trust

Also tried:

<html>

    <head>

    	Generic CPAC database
    </head>

    <body>

    	<?php
    		error_reporting(E_ALL);


pg_connect("host=localhost port=5432 dbname=cpacweb");

echo pg_dbname();

?>

    </body>


</html>

No success, but:

<html>

    <head>

    	Generic CPAC
    </head>

    <body>

    	<?php
    		//echo '<p>Hello World</p>'

    		/*successful test of configuration of apache http server*/
    		phpinfo();
    	?>

    </body>


</html>

returns a successful web page of system information details.

Please how to connect successfully to the postgresql database?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.