So I'm new to creating a database. I've looked over many other questions similar to mine. I did find something similar with adjusting ports however im not sure how to do that. Nor if it would fix my issue. I am using cleardb if that helps.
<?php
require_once 'KLogger.php';
require_once 'dbconfig.php';
KLogger('/Users/rluth/OneDrive/Documents/GitHub/Website', KLogger::DEBUG);
try {
$dsn = "mysql:host = $host;dbname=$db";
echo "gonna try to connect <br>"; $username . "<br> password " . $password . "<br>";
$dbn = new PDO($dsn, $username, $password);
echo "connectoin succesful";
$dbn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "connectoin succesful";
}
catch (Exception $e) {
echo "connection failed: " . $e->getMessage();
}
?>
i commented out a lot of things to make sure they werent the issue. Also if someone could let me know what i can use protected for $logger that would be awesome. However, i keep getting this issue.
connection failed: SQLSTATE[HY000] [2002] No such file or directory
i could connect to it by putting in the info directly but i'd rather be able to hide the credentials. I checked to see if the files existed and they do. I checked to see if the credentials were correct and they were. Im unsure of what to do from here. Any help is appreciated