环境:Ubuntu 14.04 ,PHP 5.5.9 ,MYSQL 5.6.30
有时我会出错
mysqli::real_connect(): SSL操作失败,代码为mysqli::real_connect():
错误讯息:
错误:1408F10B:SSL例程:SSL3_GET_RECORD:版本号错误
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密码:
在此行失败:
$link = $this->objMySqli->real_connect($this->Server, $this->Username, $this->Password, $this->Database, $this->Port);