gpt4 book ai didi

php - 如何修复 "mysqli::real_connect(): SSL operation failed"错误?

转载 作者:太空宇宙 更新时间:2023-11-03 14:45:31 26 4
gpt4 key购买 nike

环境:Ubuntu 14.04、PHP 5.5.9、MYSQL 5.6.30

有时我会收到错误

mysqli::real_connect(): SSL operation failed with code 1. OpenSSL

错误信息:

error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

front/nginx在一台服务器上,mysql在另一台服务器上。

错误不是连续的,它是随机发生的,我在错误日志中找到了这些错误消息,所以我无法真正进行全面调试。

示例:

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$this->objMySqli = mysqli_init();
mysqli_options ($this->objMySqli, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);

$this->objMySqli->ssl_set($this->SslKey, $this->SslCertificate, $this->SslCACertificate, null, null);

$link = $this->objMySqli->real_connect($this->Server, $this->Username, $this->Password, $this->Database, $this->Port);

if (!$link) {
throw new QMySqliDatabaseException("Unable to connect to Database", -1, null);
}

SSL 密码:

enter image description here

在这一行失败了:

$link = $this->objMySqli->real_connect($this->Server, $this->Username, $this->Password, $this->Database, $this->Port);

最佳答案

是mysql 5.6.30版本的问题,我已经更新到 5.6.32,现在这个错误不再发生了。

关于php - 如何修复 "mysqli::real_connect(): SSL operation failed"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39330686/

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