gpt4 book ai didi

php - Codeigniter 3 MySQLi 安全数据库连接

转载 作者:行者123 更新时间:2023-12-04 15:04:47 25 4
gpt4 key购买 nike

最近我的数据库团队为加密连接升级了数据库。我们使用 Codeigniter 3 构建的门户开始抛出以下错误。

Severity: Warning

Message: mysqli::real_connect(): (HY000/3159): Connections using insecure transport are prohibited while --require_secure_transport=ON.

Filename: mysqli/mysqli_driver.php

Line Number: 203

之前在数据库端进行此更改之前,它工作正常。当我尝试查看 Codeigniter 论坛时,我被要求检查以下链接。

https://forum.codeigniter.com/thread-77193-post-384725.html#pid384725 --> https://dev.mysql.com/doc/mysql-security-excerpt/8.0/en/using-encrypted-connections.html#using-encrypted-connections-client-side-configuration

我们有两个站点,一个是使用 Sprint 引导 (Java) 构建的,它只使用 (useSSL=true),他们没有遇到这些问题。但是 Codeigniter 开始抛出上述错误,我对此一无所知。

其他细节:代码点火器版本:3.1.11PHP 7.3.11

下面还有我在 codeigniter 端的连接字符串。

$db['default'] = array(
'dsn' => '',
'hostname' => 'dbhost',
'username' => 'dbusername',
'password' => 'password',
'database' => 'dbname',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE,
);

最佳答案

您需要更多配置来设置 MySQL 连接上的 SSL key 。在加密 key 中创建一个数组并用这个键/值填充它。

‘ssl_key’ - Path to the private key file
‘ssl_cert’ - Path to the public key certificate file
‘ssl_ca’ - Path to the certificate authority file
‘ssl_capath’ - Path to a directory containing trusted CA certificates in PEM format
‘ssl_cipher’ - List of allowed ciphers to be used for the encryption, separated by colons (‘:’)
‘ssl_verify’ - TRUE/FALSE; Whether to verify the server certificate or not (‘mysqli’ only)

关于php - Codeigniter 3 MySQLi 安全数据库连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66380226/

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