I want to connect to a remote (AWS) mysql server using ssl in PHP .. p>
My script works when I execute it through the command line, but not when I call it from the browser.
$con=mysqli_init();
mysqli_ssl_set($con,NULL,NULL,"path/to/cacert.pem",NULL,NULL);
$link = mysqli_real_connect($con, "host", "username", "password");
I am using php7 / Apache / CentOs. I tried to change the ownership and permissions of the CA file and noticed that this required read permission to be executed on the console. But in the browser, even if I give full permission to everyone (chmod 777), it still doesn't work.
The error I get is:
Warning: Could not load cafile stream. When I check the existence of a file, it returns true, but when I check is_readible, then there is also an error.
Can anyone help? Thanks!
source
share