1
I’m trying to make a PHP Login system using Postgresql but I can’t get my application to connect to the database. follows the code:
<?php
$connect = pg_connect("dbname=testebd"); //Banco de dados previamente criado
if (!$connect)
{
echo "Conexão não realizada";
} else
{
echo "Conexão bem sucedida";
}
?>
When I run my application, absolutely nothing happens. The page is completely blank. I can’t even print the contents of the variable:
$connect = pg_connect("dbname=testebd");
echo "$connect";
Can anyone tell me why the connection is not being realized. Note: I use the Apache server on an Ubuntu and can normally use the postegreSQl by bash.
enable php error messages
– Daniel Omine
Blank page and error 500, mean programming error. Enable error display by adding these two lines at the beginning of the file,
ini_set('display_errors', true); error_reporting(E_ALL);
– rray
Managed to solve?
– rray
Now the error that is appearing when I do if(!($connection= pg_connect ("host=localhost dbname=iluminecar port=5432 user=sullyvan password="))) { print "Could not establish a connection to the database." ; } Else { pg_close ($connected); print "Connection OK!" ; } is Fatal error: Call to Undefined Function pg_connect() in /var/www/html/index.php on line 24
– Sullyvan Nunes
I managed to solve, installed php5-pgsql and set display_errors = on
– Sullyvan Nunes