title: SSL peer certificate or SSH remote key was not OK
body: <p>I'm testing an API that uses <code>curl_exec</code> php function and a CA certificate but something is going wrong and I'm a little lost.</p>
  
  <p>I have configured SSL on my apache VirtualHost and looks ok ( opening <code>https:://[myVHost]</code>...  works ).</p>
  
  <p>However the API curl call give me back this message:  </p>
  
  <ul>
  <li><code>SSL peer certificate or SSH remote key was not OK</code></li>
  </ul>
  
  <p>I'm not very experienced with SSL so I have few ideas about the cause of that.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>This is the code I'm using in my cURL request, I have commented 2 lines and changes their value (look at 'TODO' line ) and in this way it is working, however this is just a work arround ...</p>
  
  <pre><code>$opts[CURLOPT_URL] = $url;
      $opts[CURLOPT_RETURNTRANSFER] = true;
      $opts[CURLOPT_CONNECTTIMEOUT] = 50;
      $opts[CURLOPT_TIMEOUT] = 100;
      $headers = array(
          'Accept: application/json',
          "User-Agent: APIXXX-PHP-Client");
      $opts[CURLOPT_HTTPHEADER] = $headers;
      $opts[CURLOPT_USERPWD] = $env-&gt;getApiKey() . ':';
      if (certificatePresent()) {
  
          //  $opts[CURLOPT_SSL_VERIFYPEER] = true;
          //  $opts[CURLOPT_SSL_VERIFYHOST] = 2;
  
          // TODO: SET IT BACK
          $opts[CURLOPT_SSL_VERIFYPEER] = 0;
          $opts[CURLOPT_SSL_VERIFYHOST] = 0;
  
          $opts[CURLOPT_CAINFO] = $path
  
        }
  
      curl_setopt_array($curl, $opts);
  
      $response = curl_exec($curl);
  </code></pre>