This is my first time with Apache, php and postgresql. This is what I did:
- I installed postgresql, wapp y pgadmin3,
- I copied the file with my project in apache/htdocs,
- open the index and try to enter in the user account of my web, but it said:
"Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] FATAL: the authentication failed for the user «'postgres'»' in C:\Bitnami\wappstack-5.5.27-0\apache2\htdocs\PROJECT\formss\class\connection.php:31 Stack trace: #0 C:\Bitnami\wappstack-5.5.27-0\apache2\htdocs\PROJECT\forms\class\connection.php(31): PDO->__construct('pgsql:host=127....', ''postgres'', ''12345'') #1 C:\Bitnami\wappstack-5.5.27-0\apache2\htdocs\PROJECT\forms\actions\user_login.php(6): connection->__construct() #2 {main} thrown in C:\Bitnami\wappstack-5.5.27-0\apache2\htdocs\PROJECT\forms\class\conection.php on line 31"
The pass that I set for the user postgress was 12345 in every step. Pgadmin3 let me change everything inside the db.
I already tried all these in Ubuntu but without a stack, it said the same. I checked the config of postgresql and see that for all the users say md5 like a lot of people suggest in other questions about this (yes, I searched and tried many solutions but they did not work for me).
The REAL problem is that with the exact same file, the project works in my office, with windows 7, now, with a clean installation of W7 and Ubuntu 14.04, don't want anything.
This is the connection code:
<?php
class connection {
private $database;
private $host;
private $port;
private $user;
private $pass;
public $db;
public function __construct(){
$this->user='postgres';
$this->pass='12345';
$this->host='localhost';
$this->database='project';
$this->port=5432;
$this->db=new PDO("pgsql:host=".$this->host.
";port=".$this->port.
";dbname=".$this->database
,"'".$this->user."'"
,"'".$this->pass."'");
$this->db->exec("SET CHARACTER SET utf8");
return $this->db;
}
public function __clone(){
trigger_error('The clone is not allowed', E_USER_ERROR);
}
}
?>