gpt4 book ai didi

ubuntu - stream_get_contents():SSL 操作失败,代码为 1。OpenSSL 错误消息:错误:0A000126:SSL 例程::读取时出现意外 eof

转载 作者:行者123 更新时间:2023-12-04 19:24:19 40 4
gpt4 key购买 nike

enter image description here
我一直在尝试在我的网站上使用 Gmail 登录。但我收到“stream_get_contents(): SSL operation failed with code 1. OpenSSL 错误消息:
错误:0A000126:SSL 例程::读取时出现意外的 eof”
网站建立在 yii2 之上,托管在 aws ubuntu 上的 nginx 服务器上。

php -i | grep -i openssl
SSL Version => OpenSSL/3.0.2
libSSH Version => libssh/0.9.6/openssl/zlib
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 3.0.2 15 Mar 2022
OpenSSL Header Version => OpenSSL 3.0.2 15 Mar 2022
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => /usr/lib/ssl/cert.pem => /usr/lib/ssl/cert.pem
openssl.capath => no value => no value
Native OpenSSL support => enabled

openssl version
OpenSSL 1.0.1f 6 Jan 2014
抛出异常的文件的位置
project-root-path/vendor/yiisoft/yii2-httpclient/src/StreamTransport.php 在第 63 行
   public function send($request)
{
$request->beforeSend();

$request->prepare();

$url = $request->getFullUrl();
$method = strtoupper($request->getMethod());

$contextOptions = [
'http' => [
'method' => $method,
'ignore_errors' => true,
],
'ssl' => [
'verify_peer' => false,
],
];

$content = $request->getContent();
if ($content !== null) {
$contextOptions['http']['content'] = $content;
}
$headers = $request->composeHeaderLines();
$contextOptions['http']['header'] = $headers;

$contextOptions = ArrayHelper::merge($contextOptions, $this->composeContextOptions($request->getOptions()));

$token = $request->client->createRequestLogToken($method, $url, $headers, $content);
Yii::info($token, __METHOD__);
Yii::beginProfile($token, __METHOD__);

try {
$context = stream_context_create($contextOptions);
$stream = fopen($url, 'rb', false, $context);
$responseContent = stream_get_contents($stream);
// see http://php.net/manual/en/reserved.variables.httpresponseheader.php
$responseHeaders = $http_response_header;
fclose($stream);
} catch (\Exception $e) {
Yii::endProfile($token, __METHOD__);
throw new Exception($e->getMessage(), $e->getCode(), $e); // this is line number 63
}

Yii::endProfile($token, __METHOD__);

$response = $request->client->createResponse($responseContent, $responseHeaders);

$request->afterSend($response);

return $response;
}

最佳答案

也刚开始遇到这个问题,经过一些研究,这似乎是 OpenSSL Lib 的问题:https://bugs.php.net/bug.php?id=79589
PHP 8.1.7 已经对此进行了修复,因此更新您的 PHP 应该可以解决此问题:
https://www.php.net/ChangeLog-8.php#8.1.7

关于ubuntu - stream_get_contents():SSL 操作失败,代码为 1。OpenSSL 错误消息:错误:0A000126:SSL 例程::读取时出现意外 eof,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72532373/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com