php - MariaDB 和 PHP 的 SSL 错误
问题描述
我有问题。我正在尝试在我的 MariaDB 数据库和我的 PHP 代码之间创建 SSL 连接。在建立连接的那一刻,它在一定程度上运行良好,因为在 PHP 错误中我开始收到以下错误:MySQL 服务器已消失,失败尝试和连接中止的数量急剧增加。
这是我的代码:
$this->connection = mysqli_init();
mysqli_options($this->connection, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
$this->connection->ssl_set('/xxx/xxx/client-key.pem', '/xxx/xx/client-cert.pem', '/xx/xxx/ca-cert.pem', NULL, NULL);
if (!$this->connection->real_connect($this->host, $this->user_db, $this->password_db, $this->database, 3306, NULL, MYSQLI_CLIENT_SSL)) {
$this->error_connect = $this->connection->connect_error;
return false;
} else {
$this->setCharset();
return true;
}
服务器或我的代码可能有什么问题?
解决方案
推荐阅读
- bash - 简单的 systemd 计时器不会触发
- asp.net - 将 setDate 值传递给控制器操作方法的 enddate 参数后,在 enddate 参数中获取 null 值
- ios - 带有 Xcode 10.1 的 Unity3d 2019.3.0f1 - 生成时间错误 - clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- listview - 如何在颤动中将列表添加到结束抽屉
- mysql - GROUP_CONCAT 在 MySQL 中不能与 IN() 一起使用
- c - Gstreamer 无法创建新管道
- django - Create Object with Foreign key with Serializer
- php - 联系表格不会在按钮按下时提交
- python - 如何通过 2 行读取数据帧以返回半长数据集
- android - Android UsbAccessory return null in android 8 and above