I'm using PHP version 5.6 and MySQL version 5.5. for DB connection using mysql_connect and I can't use mysqli. The ssl coonection code for only Mysqli, not able to get the code for mysql connection.
Anyone tell me how to make an SSL DB connection from PHP to MYSQL_CONNECT?
example like the below connection,
<?php
ini_set ('error_reporting', E_ALL);
ini_set ('display_errors', '1');
error_reporting (E_ALL|E_STRICT);
$db = mysqli_init();
mysqli_options ($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
$db->ssl_set('/etc/mysql/ssl/client-key.pem', '/etc/mysql/ssl/client-cert.pem', '/etc/mysql/ssl/ca-cert.pem', NULL, NULL);
$link = mysqli_real_connect ($db, 'ip', 'user', 'pass', 'db', 3306, NULL, MYSQLI_CLIENT_SSL);
if (!$link)
{
die ('Connect error (' . mysqli_connect_errno() . '): ' . mysqli_connect_error() . "
");
} else {
$res = $db->query('SHOW TABLES;');
print_r ($res);
$db->close();
}
?>