【问题标题】:PHP Warning: fgets(): SSL operation failed with code 1PHP 警告:fgets(): SSL 操作失败,代码为 1
【发布时间】:2018-01-25 11:39:45
【问题描述】:

这是错误日志,我不知道如何解决。

[2018 年 1 月 25 日星期四 10:39:42.689306] [:error] [pid 21084] PHP 警告:fgets():SSL 操作失败,代码为 1。 OpenSSL 错误消息:
错误:06065064:数字信封例程:EVP_DecryptFinal_ex:错误解密
错误:06065064:数字信封例程:EVP_DecryptFinal_ex:错误解密
错误:06065064:数字信封例程:EVP_DecryptFinal_ex:错误解密错误:06065064:数字信封例程:EVP_DecryptFinal_ex:第 156 行 ../vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket/Connection/Socket.php 中的错误解密

public function read($size = null)
{
    $got_data = false;
    $literal_len = null;
    $token = new Horde_Imap_Client_Tokenize();

    do {
        if (feof($this->_stream)) {
            $this->close();
            $this->_params['debug']->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->_stream)) !== false) {
                $got_data = true;

                if (substr($in, -1) === "\n") {
                    $in = rtrim($in);
                    $this->_params['debug']->server($buffer . $in);
                    $token->add($in);
                    break;
                }

                $buffer .= $in;
                $token->add($in);
            }

            /* Check for literal data. */
            if (is_null($len = $token->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 > 0) && !feof($this->_stream)) {
            $in = fread($this->_stream, min($literal_len, 8192));
            /* Only store in stream if this is something more than a
             * nominal number of bytes. */
            if ($old_len > 256) {
                $token->addLiteralStream($in);
            } else {
                $token->add($in);
            }

            if (!empty($this->_params['debugliteral'])) {
                $this->_params['debug']->raw($in);
            }

            $got_data = true;
            $literal_len -= strlen($in);
        }

        $literal_len = null;

        if (empty($this->_params['debugliteral'])) {
            $this->_params['debug']->server('[' . ($binary ? 'BINARY' : 'LITERAL') . ' DATA: ' . $old_len . ' bytes]');
        }
    } while (true);

    if (!$got_data) {
        $this->_params['debug']->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;
}

错误出现在

while (($in = fgets($this->_stream)) !== false) {

我在同一台服务器上有另一个应用程序实例,设置相同,只是数据库和域名不同。

另一个实例似乎工作得很好,没有出现这个错误的问题。

注意:Horde 是一种用于发送电子邮件的 PHP 库。

谁能帮帮我?

【问题讨论】:

  • 如果这是一个编程问题,您应该分享更多信息,而不仅仅是错误日志。我能想到的最低限度:一些代码、流包装器和 URI 协议。如果您只是部落用户并且这是一个支持问题,那么恐怕您来错论坛了。
  • 我添加了一些关于错误发生的更多信息。

标签: php ssl horde


【解决方案1】:

请尝试如下更改您的设置:

<?php
    $yourArrayOptions=array(
    "ssl"=>array(
    "verify_peer"=>false,
    "verify_peer_name"=>false,
 ),
)
$response = file_get_contents("fileName", false, 
stream_context_create($yourArrayOptions));
echo $response; ?>

请点击这里获得更好的解释file_get_contents(): SSL operation failed with code 1. And more

【讨论】:

  • 你能再检查一下我的问题吗?刚刚编辑过。
猜你喜欢
  • 2018-03-07
  • 2019-03-02
  • 2015-01-21
  • 1970-01-01
  • 2021-05-14
  • 1970-01-01
  • 2015-04-27
  • 2013-08-25
  • 1970-01-01
相关资源
最近更新 更多