I just created a domain on locaweb and created a website and database.
When I access the site, it loads part of the page, but I get the following error:
SQLSTATE [HY000] [2002] Can not connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Fatal error: Call to a member function query () on a non-object in /home/storage/9/04/78/gabrieldevito/public_html/gentelella-master/production/Classes/Persistencia/ContaCrud.php on line 44
The connection class with the bank is:
class Connection {
public $host = 'localhost';
public $dbname = 'usodecontas';
public $username = 'root';
public $password = 'abc123';
public function conectar() {
try {
$conn = new PDO("mysql:host={$this->host};dbname={$this->dbname}", $this->username, $this->password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $conn;
} catch (PDOException $e) {
echo $e->getMessage();
}
}
}
People, the support of locaweb is terrible and I can not find some tutorial that helps me to make a remote connection on the server so I can apply some commands that exist in other topics. Has anyone ever had similar problems?
Thank you.