I have found the answer after a long search and with the help from people from doctrine chat room.
This is the dbal configuration that works on PHP > 5.3.7
It uses three PDO Constants which are not available to PHP prior to 5.3.7
In standard PDO connection:
$conn = new PDO("mysql:host=localhost;port=3307;database=dbname", "user1", "password1",
array(
1010 => '/path/to/certs/priv_key.pem',
1011 => '/path/to/certs/pub_cert.pem',
1012 => '/path/to/certs/ca_cert.pem',
)
);
If trying the above code gives you an error, it is possible that your PHP version is < 5.3.7 then you are unlikely to be able to use PDO with SSL.
Now the solution to the DBAL configuration in config.yml
doctrine:
dbal:
default_connection: default
connections:
default:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
password: %database_password%
charset: UTF8
mapping_types:
enum: string
options:
1010 : %priv_key%
1011 : %pub_cert%
1012 : %ca_cert%
default2: # second connection ...
orm:
# orm configuration here ....
Hope this helps anyone who are trying to connect using SSL. As a matter of fact, it is recommended to connect using SSL for all your database connection, if it is possible to do so.