I have my website working fine on my local machine, but have just ssh'd into my server and cloned my git repository but getting this:
ERROR: SQLSTATE[HY000] [2002] No such file or directory
And then an error with the connection variable which is set in a try catch.
All my database credentials are correct, 100% and I have logged into the server.
Any help?
Edit:
$host = '127.0.0.1';
$dbname = 'doseofst_every_hour';
$username = 'doseofst_craig';
$password = 'password';
try {
$conn = new PDO(
"mysql:host = $host;dbname=$dbname",
$username,
$password
);
// show errors
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}