Symfony2 doctrine.dbal.connection_factory with ssl?

I am connecting to a remote database from my symfony2 application using this code

$connectionFactory = $this->container->get('doctrine.dbal.connection_factory'); $conn = $connectionFactory->createConnection(array( 'driver' => 'pdo_mysql', 'user' => 'mattias', 'password' => 'fdfsdf', 'host' => 'fs1.rrtgy.se', 'dbname' => 'csmedia', )); return $conn; 

Is there a parameter that I can set for this using SSL?

Equivalent to something like this:

 $link = mysql_connect("192.112.7.18","test","testpass",false,MYSQL_CLIENT_SSL) 
+4
source share
1 answer

You can try adding an array of 'driverOptions' to createConnection

 $conn = $connectionFactory->createConnection(array( 'driver' => 'pdo_mysql', 'user' => 'mattias', 'password' => 'fdfsdf', 'host' => 'fs1.rrtgy.se', 'dbname' => 'csmedia', 'driverOptions' => array( PDO::MYSQL_ATTR_SSL_CA =>'/path/to/ssl-ca.pem' ), )); 

Learn more about MYSQL SSL constants .

Note that some constants were added in php 5.3.7

However, SSL parameters are silently ignored (at least) version 5.3.8: see error report .

0
source

Source: https://habr.com/ru/post/1479936/


All Articles