title: cannot connect php to postgres database using pg_connect
body: <p>I just try to connect my php code to postgres database but unfortunately it is not work, here is my code :</p>
  
  <pre><code>&lt;?php
  ini_set ("display_errors", "1");
  error_reporting(E_ALL);
     $host        = "host=127.0.0.1";
     $port        = "port=5432";
     $dbname      = "dbname=public";
     $credentials = "user=postgres password=postgres";
  
     $db = pg_connect( "$host $port $dbname $credentials"  ) or die('Could not connect');;
     if(!$db){
        echo "Error : Unable to open database\n";
     } else {
        echo "Opened database successfully\n";
     }
  </code></pre>
  
  <p>browser result :</p>
  
  <p><strong>Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: database &quot;public&quot; does not exist in /var/www/test/pgtest.php on line 11</strong></p>
  
  <p>anybody know what is wrong here ?</p>