I am a bit new when creating and managing web servers, and I am having problems trying to configure my website in Strato (a web hosting service). I have used other hosts in the past, and most of them in the same way, so the code should not change much. However, with this host, I cannot connect to the database. They do not offer much help about it in the faqs, so I thought to ask you whilst I wait for their reply.
I would like to know if I am doing something wrong in the following code:
<?php
$dsn = 'mysql:host=rdbms.strato.de;dbname=DB2613867';
$username = 'U******';
$password = '*******';
try {
$db = new PDO($dsn, $username, $password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
}
// more code
?>
It throws an internal server error.
PS: the way they offer to connect to the database is without PDO.
Thank you!
I have checked the username, password and database name, and they are all correct as far as I know
Aucun commentaire:
Enregistrer un commentaire