Unable to set local cert chain file
<p>I have trouble with establishing a SSL connection.</p>
<p>These warnings are displayed:</p>
<blockquote>
<p>Warning: stream_socket_client() [function.stream-socket-client]: Unable to set local cert chain file `D:\path\cert.pem'; Check that your cafile/capath settings include details of your certificate and its issuer in D:\path\testSll.php on line 23</p>
<p>Warning: stream_socket_client() [function.stream-socket-client]: failed to create an SSL handle in D:\path\testSll.php on line 23</p>
<p>Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in D:\path\testSll.php on line 23</p>
<p>Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://host.tld:700 (Unknown error) in D:\path\testSll.php on line 23</p>
</blockquote>
<p>So I read all the question about the &quot;Unable to set local cert chain file&quot;, but all the answer I found didn't work for me.</p>
<p>Here is the code I use :</p>
<pre><code>$host = 'host.tld';
$port = 700;

$cert = dirname(__FILE__).'\\cert.pem'; //
$passe_phrase = 'pass';

$opts = array(
        'ssl'=&gt;array(
            'local_cert'    =&gt; $cert,
            'passphrase'    =&gt; $passe_phrase,
            'verify_peer'   =&gt; false 
        )
    ); 

$context = stream_context_create($opts);

$fp = stream_socket_client('ssl://'.$host.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);

if ($fp) {
    echo &quot;OK&quot;;
} else {
    echo &quot;ERROR: $errno - $errstr&lt;br /&gt;\n&quot;;
}
</code></pre>
<p>The certificate is the good one.
The script can access to the file cert.pem.</p>
<p>I cant find what I am missing here.</p>
<p>PHP version : 5.2.6</p>