I'm trying to determine if I need to use mysqli_ssl_set to encrypt my db layer. I have a standard Amazon RDS instance that I'm connecting to with MySQL user and pass, but I'm unsure if that connection is automatically encrypted. My server is SSL-ready, but does that mean mysqli_connect is encrypted by default?
This is my code right now:
$connection = mysqli_connect(self::$host, self::$user, self::$password);
self::$lastConnection = $connection;
$db = "db_prod";
mysqli_select_db($connection, $db);
mysqli_set_charset($connection, "utf8mb4");
Do I need to add in mysqli_ssl_set too?
1 Answer 1
No, you have to call
mysqli_ssl_set(connection, key, cert, ca, capath, cipher)
or
$mysqli -> ssl_set(key, cert, ca, capath, cipher)
answered Jun 19, 2021 at 20:52
nbk
8,7096 gold badges15 silver badges27 bronze badges
-
I'm using Letsencrypt for my SSL. Would you happen to know how to fill in mysqli_ssl_set? I tried this: mysqli_ssl_set($con, "/var/lib/mysql/privkey.pem", "/var/lib/mysql/cert.pem", "/var/lib/mysql/chain.pem", NULL, NULL); but it doesn't work.Tony Friz– Tony Friz2021年06月20日 00:32:34 +00:00Commented Jun 20, 2021 at 0:32
-
have you all those files correctly add to the server . Run
SHOW VARIABLES LIKE '%ssl%';and see also there could be a tls problem.nbk– nbk2021年06月20日 01:29:17 +00:00Commented Jun 20, 2021 at 1:29
lang-sql