How to connect to an Amazon MySQL RDS instance via PHP over SSL

前端 未结 2 1219
野的像风
野的像风 2020-12-21 02:23

I have an EC2 instance running a WordPress site. The WordPress db is on a RDS instance. I want to connect to the db over SSL.

From what I\'ve read, the MySQL exten

2条回答
  •  天命终不由人
    2020-12-21 02:44

    Turns out this was less complicated than I thought. Turning up the error reporting level uncovered an error in my code that I hadn't caught. Using ssl_set this way works:

    $db = mysqli_init();
    $db->ssl_set(NULL,NULL,'/path/to/mysql-ssl-ca-cert.pem',NULL,NULL);
    $db->real_connect($dbhost,$dbuser,$dbpassword,$dbname);
    

提交回复
热议问题