novocent
asked on
How do I connect from php to mySQL using SSL?
How do I make a connection from a php script to a mysql database using SLL to encrypt the transferred data?
Where are the PHP and MySQL hosts (what URLs)?
ASKER
mgrennan, I want to connect via SSL to secure the transfer of data between the php server and the mysql server. The mysql server is on a remote host.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mgrennan, I will look into that info. I started to make and installed certificates earlier today, but never completed the process. I came across another idea and it seemed to work. I was hoping to confirm the solution: I used this connection:
$conn = mysql_connect("XXX.XXX.XXX .XXXX", "username", "password",true, MYSQL_CLIENT_SSL);
on the remote mysql database I used:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'remoteIP' IDENTIFIED BY 'password' REQUIRE SSL;
It made a connection which I think is SSL, I know of no way to confirm that. I do know that trying to use only $conn = mysql_connect("XXX.XXX.XXX .XXXX", "username", "password") fails. It seemed so simple that I was doubting the SSL connection. And doubting whether the information transferred from the mysql database to the remote php was actually encrypted. Any thoughts?
$conn = mysql_connect("XXX.XXX.XXX
on the remote mysql database I used:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'remoteIP' IDENTIFIED BY 'password' REQUIRE SSL;
It made a connection which I think is SSL, I know of no way to confirm that. I do know that trying to use only $conn = mysql_connect("XXX.XXX.XXX
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<?php
$link = mysql_connect('localhost',
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
See http://us.php.net/function.mysql-connect