I'm trying to connect Mysql with SSL connection in symfony 3.4. I have tested plain PDO connection and it works fine but when I tried to integrate to same in Symfony, I get errors.
Plain PDO connection which works fine
$pdo = new PDO('mysql:host=HOST', 'USER', 'PASS', array(
PDO::MYSQL_ATTR_SSL_CA =>'certificate.crt.pem',
));
Following is the list of options i have tried in symfony but failed
Method 1
#app/config/config.yml
dbal:
< other config>
options:
!php/const:PDO::MYSQL_ATTR_SSL_CA: %ca_cert%
Method 2
#app/config/config.yml
dbal:
< other config>
options:
MYSQL_ATTR_SSL_CA: %ca_cert%
Method 3
#app/config/config.yml
imports:
- { resource: parameters.php }
dbal:
< other config>
options: %pdo_options%
#parameters.php
$this->container->setParameter("pdo_options", [
PDO::MYSQL_ATTR_SSL_CA => "certicate.crt.pem",
]);
I'm seeing this error for all the above methods:
Uncaught PHP Exception PDOException: "SQLSTATE[HY000] [3159] Connections using insecure transport a re prohibited while --require_secure_transport=ON."
source https://stackoverflow.com/questions/70657125/symfony-ssl-parameters-setup-in-doctrine-connection
Comments
Post a Comment