Using Doctrine and in 'driver' => 'pdo_mysql'.
I am trying to connect with the AWS MYSQL instance over SSL, but getting failing.
As per MySQL and AWS Document i have to provide --ssl-mode=required.
I have tried this: but it looks like pdo_mysql doesn’t support sslmode option.
$options = [
'dbname' => $dbName,
'user' => $user,
'password' => $password,
'host' => $host,
'driver' => 'pdo_mysql',
'sslmode' => 'REQUIRED',
];
return DriverManager::getConnection($options);
And even with PHP PDO also:
$pemPath = __DIR__ . '/global-bundle.pem';
$pdoOptions = [
PDO::MYSQL_ATTR_SSL_CA => file_get_contents($pemPath),
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
];
$pdo = new PDO("mysql:host=$host;port=3306;dbname=$dbName", $user, $password, $pdoOptions);
return DriverManager::getConnection(['pdo'=>$pdo]);
But getting no success.
The only way I got success when I connect using the command line:
mysql -uUser -p -h mysql-xx-abc.eu-west-1.rds.amazonaws.com --ssl-mode=REQUIRED
my php version is 74