Recently my db team upgraded db for encrypted connection. And Our portal built with using Codeigniter 3 started throwing below error.
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
Previously before this change on the db side, it was working fine. And when i try to check with Codeigniter forum i was asked to check for the below link.
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
We have two sites one built with Sprint boot (Java) which uses simply (useSSL=true) and they don't get those issues. But Codeigniter started throwing the above error and i do not have clue on that.
Other details: Codeigniter Version: 3.1.11 PHP 7.3.11
Also Below is my connection string on the codeigniter side.
$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,
);
                You need some more configurations to set your SSL keys on the MySQL connection. In encrypt key create an array and fill it with this key/values.
‘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)
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With