title: How to create an encrypted connection to SQL Server from Ubuntu using PHP/PDO
body: <p>I'm trying to connect to an SQL Server from a PHP/Zend Framework application running on Ubuntu and at a remote location.</p>
  
  <p>I'm trying to get the connecting application to request encryption from the SQL Server (since the default connection on 1433 is in the clear, and I don't want my credentials being sniffed).</p>
  
  <p>I've configured the wildcard SSL certificate on the SQL Server, and I'm creating a PDO connection with the following DSN:</p>
  
  <pre><code>dblib:host=server-not-matching-domain.com:1433;dbname=MyDB;Encrypt=true;TrustServerCertificate=false;charset=
  </code></pre>
  
  <p>Taken from <a href="http://blogs.msdn.com/b/brian_swan/archive/2011/03/08/sql-server-driver-for-php-connection-options-encrypt.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/brian_swan/archive/2011/03/08/sql-server-driver-for-php-connection-options-encrypt.aspx</a></p>
  
  <p>Since the host name doesn't match the installed certificate, I'd expect the connection to fail - but it doesn't fail.</p>