title: PHP Warning: fgets(): SSL operation failed with code 1
body: <p>This is the error log, and i have no idea how to solve this.</p>
  
  <blockquote>
    <p>[Thu Jan 25 10:39:42.689306 2018] [:error] [pid 21084]
        PHP Warning: fgets(): SSL operation failed with code 1. 
        OpenSSL Error messages:<br>error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt<br>error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt<br>error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt<br>error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt in ../vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket/Connection/Socket.php on line 156</p>
  </blockquote>
  
  <pre><code>public function read($size = null)
  {
      $got_data = false;
      $literal_len = null;
      $token = new Horde_Imap_Client_Tokenize();
  
      do {
          if (feof($this-&gt;_stream)) {
              $this-&gt;close();
              $this-&gt;_params['debug']-&gt;info(
                  'ERROR: Server closed the connection.'
              );
              throw new Horde_Imap_Client_Exception(
                  Horde_Imap_Client_Translation::r("Mail server closed the connection unexpectedly."),
                  Horde_Imap_Client_Exception::DISCONNECT
              );
          }
  
          if (is_null($literal_len)) {
              $buffer = '';
  
              while (($in = fgets($this-&gt;_stream)) !== false) {
                  $got_data = true;
  
                  if (substr($in, -1) === "\n") {
                      $in = rtrim($in);
                      $this-&gt;_params['debug']-&gt;server($buffer . $in);
                      $token-&gt;add($in);
                      break;
                  }
  
                  $buffer .= $in;
                  $token-&gt;add($in);
              }
  
              /* Check for literal data. */
              if (is_null($len = $token-&gt;getLiteralLength())) {
                  break;
              }
  
              // Skip 0-length literal data.
              if ($len['length']) {
                  $binary = $len['binary'];
                  $literal_len = $len['length'];
              }
  
              continue;
          }
  
          $old_len = $literal_len;
  
          while (($literal_len &gt; 0) &amp;&amp; !feof($this-&gt;_stream)) {
              $in = fread($this-&gt;_stream, min($literal_len, 8192));
              /* Only store in stream if this is something more than a
               * nominal number of bytes. */
              if ($old_len &gt; 256) {
                  $token-&gt;addLiteralStream($in);
              } else {
                  $token-&gt;add($in);
              }
  
              if (!empty($this-&gt;_params['debugliteral'])) {
                  $this-&gt;_params['debug']-&gt;raw($in);
              }
  
              $got_data = true;
              $literal_len -= strlen($in);
          }
  
          $literal_len = null;
  
          if (empty($this-&gt;_params['debugliteral'])) {
              $this-&gt;_params['debug']-&gt;server('[' . ($binary ? 'BINARY' : 'LITERAL') . ' DATA: ' . $old_len . ' bytes]');
          }
      } while (true);
  
      if (!$got_data) {
          $this-&gt;_params['debug']-&gt;info('ERROR: read/timeout error.');
          throw new Horde_Imap_Client_Exception(
              Horde_Imap_Client_Translation::r("Error when communicating with the mail server."),
              Horde_Imap_Client_Exception::SERVER_READERROR
          );
      }
  
      return $token;
  }
  </code></pre>
  
  <p>The error appears at </p>
  
  <pre><code>while (($in = fgets($this-&gt;_stream)) !== false) {
  </code></pre>
  
  <p>I have another Instance of my application on the same server with the same settings just different database and domain name.</p>
  
  <p>The other Instance seems to work just fine without having problems with this error.</p>
  
  <p>Note: Horde is a kind of PHP library for sending Emails.</p>
  
  <p>Can anyone help me?</p>