Jump to content

[Solved] I'm Getting An Error Trying To Connect To A Postgresql Database


kamesenin

Recommended Posts

This is the error:

Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "::1", user "postgres", database "inmobiliaria", SSL off in /home/inver/public_html/inmobiliaria/consulta.php on line 12

This is the file that connects to the database. Although locally it works.

<?php

/*Conexion a la base de datos*/

$user = "inver_inverdata";
$password = "*******";
$dbname = "inver_inmobiliaria";
$port = "5432";
$host = "localhost";

$cadenaConexion = "host=$host port=$port dbname=$dbname user=$user password=$password";

$conexion = pg_connect($cadenaConexion) or die("Error en la Conexión: ".pg_last_error());


 
/*$query = "select id, usuario, contrasenia from usuario";

$resultado = pg_query($conexion, $query) or die("Error en la Consulta SQL");
*/



?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...