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

前端 未结 2 1208
野的像风
野的像风 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);
    
    0 讨论(0)
  • 2020-12-21 02:57

    Try this:

    $db = mysqli_init();
    $db->ssl_set(null, 'https://rds.amazonaws.com/doc/mysql-ssl-ca-cert.pem', null, null, null);
    
    0 讨论(0)
提交回复
热议问题