php 5.x 7.x, ssl pdo error: Peer certificate CN=`someName' did not match expected CN='someIP'
<p>We have a server with mysql on port 3306. We have sertifications and key and we try to connect to this server. But we see such problem:</p>

<blockquote>
  <p>Peer certificate CN='SomeName' did not match expected CN='someIP'</p>
</blockquote>

<p>I've read a lot of articles and can't find answer for PDO PHP. The most interesting is that the SQLYog could connect with all settings.</p>

<p>I've read that I verify_peer_names can be disabled (I hope I understand what is peer_names...), but only if we use openssl_{functions} or mysqli, not PDO. Both options are not appropriate for me. I need PDO.</p>

<p>What I tried to do:</p>

<ul>
<li>switch between versions of php. It helped me, but I need 5.6 or higher. For php 7.0 the same error.</li>
<li>find another versions of openssl and pdo; fast I understood that its a bad idea :)</li>
<li>find some settings in php.ini, but no settings for my problem, only for creating ssl.</li>
</ul>

<p>My code for connection:</p>

<pre><code>$dbInfo = array
(
'dsn' =&gt; 'mysql:host=123.45.67.890;dbname=someDB;port=3306',
'user' =&gt; 'user',
'pass' =&gt; 'userpassword'
);

$con = new PDO
    (
    $dbInfo['dsn'], $dbInfo['user'], $dbInfo['pass'], 
    array(
        PDO::MYSQL_ATTR_SSL_CIPHER =&gt; 'AES256-SHA',
        PDO::MYSQL_ATTR_SSL_CA     =&gt; 'SSLCert/ca-cert.pem',
        PDO::MYSQL_ATTR_SSL_KEY    =&gt; 'SSLCert/client-key.pem',
        PDO::MYSQL_ATTR_SSL_CERT   =&gt; 'SSLCert/client-cert.pem',
    )
    );

echo 'Connection OK!';
</code></pre>