When Connecting to mySQL I get this Error: Server sent charset unknown to the client.Error on my local host
So this issue occurs in the database connection file the code for that file looks like this
<?php
// Set up the database connection
//Revisit upon later implementation
$dsn = 'mysql:host=localhost;dbname=resumesite;charset=UTF8;';
$username = 'ddunevant';
$password = 'WoShiHenHao1!';
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
try {
//$db = new mysqli('127.0.0.1', $username, $password, 'test');
$db = new PDO($dsn, $username, $password, $options);
} catch (PDOException $e) {
$error_message = $e->getMessage();
include('errors/db_error_connect.php');
exit();
}
?>
I have however viewed a great deal online saying that the issue is originating in the configuration files of MySQL. This post answers my question in this way: PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers
However I've tried this and many other things like it. One thing that separates my situation from theirs is that I'm using Bitnami Wampstack. I've changed my my.ini to the following.
[client]
default-character-set=UTF8
[mysqladmin]
user=root
port=3307
# The MySQL server
[mysqld]
# set basedir to your installation path
basedir="C:/Bitnami/wampstack-5.6.40-0/mysql"
# set datadir to the location of your data directory
datadir="C:/Bitnami/wampstack-5.6.40-0/mysql/data"
port=3307
character-set-server=UTF8
collation-server=utf8_unicode_ci
max_allowed_packet=32M
bind-address=127.0.0.1
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
log-error="C:/Bitnami/wampstack-5.6.40-0/mysql/data/mysqld.log"
[mysqldump]
max_allowed_packet=32M
[mysql]
port=3307
As you can see I'm changing the collation server to the proper collation set, "collation-server=utf8_unicode_ci." What else should I do to fix this issue?