title: Error "BIO_new_file:no such file" by using "openssl_pkcs7_decrypt" in PHP
body: <p>I have encrypted a file thanks to OpenSSL with the following command:</p>
  
  <pre><code>openssl smime -encrypt -in myfile.xml -out myfile.p7m -outform DER -binary publicKey.pem
  </code></pre>
  
  <p>Now, I would to decrypt the file "myfile.p7m" with PHP. Currently, I'm using this code but without success:</p>
  
  <pre><code>$output = "myfile.xml";
  $crt = file_get_contents("mycert.crt");
  $private = openssl_pkey_get_private (file_get_contents("privateKey.pem"), "password");
  openssl_pkcs7_decrypt ("myfile.p7m", $output, $crt, $private);
  while($error = openssl_error_string()){
      echo $error.'&lt;br /&gt;'.PHP_EOL;
  }
  </code></pre>
  
  <p>At this moment, I get this error:</p>
  
  <pre><code>error:2006D080:BIO routines:BIO_new_file:no such file
  </code></pre>
  
  <p>I have no idea what this mean.</p>
  
  <p>Can you help me?</p>
  
  <p>PS:
  I have already decrypted this file with success by using an OpenSSL command:</p>
  
  <pre><code>openssl smime -decrypt -in myfile.p7m -out myfile.xml -inkey 
  privateKey.pem -inform DER -passin pass:password
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>Follow the advice of Vladimir Kunschikov, I've used full path for the files. I've replaced "<em>myfile.xml</em>" by "<em>file://c:/wamp/www/test/myfile.xml</em>" and "<em>myfile.p7m</em>" by "<em>file://c:/wamp/www/test/myfile.p7m</em>". Now, I have two another errors:</p>
  
  <pre><code>error:0200107B:system library:fopen:Unknown error
  error:2006D002:BIO routines:BIO_new_file:system lib
  </code></pre>
  
  <p><strong>Edit 2</strong></p>
  
  <p>Thank you Giovani for your response. I replace all paths as you have directed. Now, a new error is appeared!</p>
  
  <pre><code>error:0D0D20CC:asn1 encoding routines:SMIME_read_ASN1:no content type
  </code></pre>