php, mysqli and ssl

Avatar
  • Answered
I'd like to encrypt the mysqli connection from my server at work (acting as client) with my Inmotion website (acting as host) in PHP. There is this PHP function: mysqli_ssl_set ( mysqli $link , string $key , string $cert , string $ca , string $capath , string $cipher ), but I am unsure of where the require certificate files are. I'm on VPS1k with a purchased SSL certificate. Do you have any sample scripts available?
Avatar
Arn
Hello Erussell, Thanks for the question. You will need to have Root Access in order to actually set this up. Additionally, you will need either a SSL certificate that you have purchased already or you need to setup a self-signed one (which can be done in WHM). The instructions in the official MySQL site actually explain how to create the PEM files that are needed and per our systems team, the SSL path can be specified anywhere (Setting Up SSL Certificates and Keys for MySQL). We do not have sample scripts for this, but you can find the information for this topic in the PHP documentation here. All of these tasks again require Root access. If you do not have it, you will need to request it. I hope this helps to clarify the issue. Apologies that we can't provide some sample scripts. Regards, Arnel C.