0

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?

asked Jun 19, 2021 at 20:27

1 Answer 1

0

No, you have to call

mysqli_ssl_set(connection, key, cert, ca, capath, cipher)

or

$mysqli -> ssl_set(key, cert, ca, capath, cipher)

see manual https://www.php.net/manual/de/mysqli.ssl-set.php

or https://www.w3schools.com/php/func_mysqli_ssl_set.asp

answered Jun 19, 2021 at 20:52
2
  • 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. Commented 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. Commented Jun 20, 2021 at 1:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.