title: MySQLi SSL connection stops working after php 7 upgrade
body: <p>I have a strange issue when moving my project from PHP 5.6 to PHP 7, I have a database class which allows you to set an SSL connection to the database after calling <code>mysqli_init();</code> and before calling <code>mysqli_real_connect()</code>.</p>
  
  <p>I have been developing this on PHP 5.6 and have successfully created a SSL connection to a remote server and all working great, the remote database server does NOT use a self signed certificate.</p>
  
  <p>In the <code>setSSL</code> method of my db class I have this:</p>
  
  <pre><code>        if($verify) { $this-&gt;mysqli-&gt;options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true); }
          $this-&gt;mysqli-&gt;ssl_set($key, $cert, $ca, $capath, $ciphers);
  </code></pre>
  
  <p>The method sets <code>$verify</code> to a default setting of <code>true</code> and left as is, the certificate bundle is passed through the variable <code>$ca</code>.</p>
  
  <p>This has been working great on PHP 5.6 and doing exactly what it should be and confirmed that the connection is indeed using an SSL connection.</p>
  
  <p>On the same server I created a sub domain and set it to use PHP 7 (I hear performance is much better and my code is PHP 7 friendly).</p>
  
  <p>I done a complete copy of my code on the new sub domain and everything works fine, except for the remote SSL mysqli connection.</p>
  
  <p>I have checked the removed features in PHP 7 and many other things but can't find out why this is happening.</p>
  
  <p>Extracts from logs:</p>
  
  <blockquote>
    <p>[Msg: mysqli::real_connect(): SSL operation failed with code 1.
    OpenSSL Error messages: error:14090086:SSL
    routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed]</p>
    
    <p>[Msg: mysqli::real_connect(): Cannot connect to MySQL by using SSL]</p>
    
    <p>[Msg: mysqli::real_connect(): [2002] (trying to connect via
    tcp://******.co.uk:3306)]</p>
  </blockquote>
  
  <p>On another note, this is the same error produced when I was first developing this feature on PHP 5.6 if I didn't pass the ca certificate bundles over.</p>