![]() |
SSL mysql - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: SSL mysql (/showthread.php?tid=62545) |
SSL mysql - iharris - 07-27-2015 Hi, I was looking for info on setting up SSL connection for mysql databases using CI3. I didnt find much. Turns out its not that hard so here are some hints that might help the next person. 1) \system\database\drivers\mysqli\mysqli_driver_php Existing line 126: $mysqli = mysqli_init(); Add the following line: $mysqli->ssl_set('YOUR_FILE-key.pem', 'YOUR_FILE-cert.pem', 'YOUR_FILE-ca.pem', NULL, NULL); 2 You can test the change with a query: show status like 'Ssl_cipher'; vardump() the return to check what cipher is being used, output should be something like: { ["Variable_name"]=> string(10) "Ssl_cipher" ["Value"]=> string(18) "DHE-RSA-AES256-SHA" } If the Ssl_cipher value is blank its not encrypted, can check by commenting the driver change out and back in again. RE: SSL mysql - mwhitney - 07-27-2015 You might want to look at this: Updated the MySQLi Driver to Support SSL Connections. Obviously, it's not in the released version of CI3, yet, but you may want to make sure that, if you choose to modify your code to support SSL, you consider whether you're going to need to change your code or database config when the next release comes along. |