title: Cannot find certificate PHP/mongodb
body: <p>Hi trying to connect to a replica set, and encountered a No suitable server found, when I checked in the logs found this error:</p>
  <blockquote>
  <p>Cannot Find certificate in ‘/etc/mongodb/ssl/pemfile.pem</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/oWywp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oWywp.png" alt="error" /></a></p>
  <p>but, when I try to run the script via command line using the same certificates and connection string, was successful and also via mongosh, however failed when trying to access via web, HTTP only.</p>
  <p>Here is my connection string.</p>
  <pre><code>$connection = new MongoDB\Client(&quot;mongodb://${username}:${password}@server1:61972,server2:61972,server3:61972/?replicaSet=mongogsavers0&amp;authSource=stg_db&quot;, array(&quot;tls&quot; =&gt; true, &quot;tlsCAFile&quot; =&gt; '/path/certificate/mongosertificate.crt', &quot;tlsCertificateKeyFile&quot; =&gt; '/path/certificate/pemfile.pem'));
  </code></pre>
  <p>PHP version: 7.2
  MongoDB: 4.2
  Library version: 1.9</p>
  <p>Thank you in advance.</p>