Azure Database for MySql is a PaaS database, that takes all the hard work of hosting a database away from you. It supports SSL and you can force all applications connecting to it to connect through SSL.
In order to get PHP talking to the database through SSL, an SSL certificate and some code changes are needed.
You need to download the SSL certificate from digicert here
Put this in a Cert folder in the root of your PHP application.
<?php $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array( PDO::MYSQL_ATTR_SSL_CA => '/BaltimoreCyberTrustRoot.crt.pem', PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false )); ?>
PDO::MYSQL_ATTR_SSL_CA obviously tells the PDO connection to use the Baltimore SSL certificate for the connection
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT actually took me a while to figure out, it just wasn’t connecting. So make sure you set this and your connection to Azure should connect.
I'm a .NET Software Engineer. Obsessed with Scrum / agile practices, DevOps, Azure... and C# of course
Nant (1) Load testing (1) Visual studio (1) Azure (29) Aws (1) Asp.net (1) Tfs (1) Puppetlabs reports (2) Devops (2) Iis (1) Powershell (9) Arm templates (2) Arm template (1) Azure (8) Arm (2) Powershell (1) Dsc (1) Jekyll (1) Vsts (1) Arm (1) Azure cli (2) Mysql (1) Php (1)