I am having an issue with the object creation with PDO.
Below is my code and it gets hangs at "new PDO". and there is no response and no error.
<?php
$user = "root";
$password = "password";
$database = "test";
$table = "test";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
var_dump($db);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
Can someone help me understand why I am getting this issue.
I am running ubuntu 20.04