0

Dear whoever closed this: the solutions to that other question all involve making changes to the MySQL server, which I very specifically said I cannot do. So that question doesn't provide me a solution.

I'm trying to connect to a MySQL database with utf8mb4 as the character set using the following in PHP 5.6

<?php
require '../env.php';
try {
    $dsn = 'mysql:host='.$mysql_hostname.';dbname='.$mysql_database.';charset=utf8mb4';
    $dbh = new PDO($dsn, $mysql_username, $mysql_password);

} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}
?>

I cannot change the MySQL server's character set. I get a similar error with mysqli. What am I missing here?

wogsland
  • 7,351
  • 16
  • 46
  • 79

0 Answers0