SSL DB connection issue -> version_compare($this->mysqli->client_info, '5.6', '>=') - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: SSL DB connection issue -> version_compare($this->mysqli->client_info, '5.6', '>=') (/showthread.php?tid=79039) |
SSL DB connection issue -> version_compare($this->mysqli->client_info, '5.6', '>=') - fedeburo - 04-12-2021 Hi, i am using CI version 4 and having problems connecting to a Database that has SSL encryption Mysqli driver with ssl_verify = false. The configuration of the database is the following: public $DB= [ 'DSN' => '', 'hostname' => '127.0.0.1', 'username' => 'user', 'password' => 'pass', 'database' => 'db', 'DBDriver' => 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, 'DBDebug' => (ENVIRONMENT !== 'production'), 'cacheOn' => false, 'cacheDir' => '', 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', 'encrypt' => array( 'ssl_ca' => '/path/to/cert/ca.pem', 'ssl_verify' =>false, ), 'compress' => false, 'strictOn' => false, 'failover' => [], 'port' => 3306, When i try to connect, the app keeps saying: Error to connecto to database , unable to connect to database, or,if no path were written in the encrypt array --> Error connecting to the database: Connections using insecure transport are prohibited while --require_secure_transport=ON. Doing var_dumps in Connection.php (lines 120-170), i realize that the problem was in the comparisson of "version_compare($this->mysqli->client_info, '5.6', '>=')" -- > this is returnign false: When i make a var_dump(($this->mysqli->client_info)); this is returning "mysqlnd 7.4.3" and the version_compare($this->mysqli->client_info, '5.6', '>=')" returning false I should achieve a connection of mysqli->real_connect(hostname, username, pass, database, 3306, NULL, 2112) 2112 = CONSTANT(MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT) + CONSTANT(MYSQLI_CLIENT_SSL). When i make a connection to a database manually, i can kkep paths values to null if the last parameter of real_conect = is 2048 or 2112 What is happening here? This should return true? What should i do in order to achieve this connection?. Wait for you answer, thanks. |