Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
connect to a mysql server over ssh in php using -'php,mysql,ssh'
connect to a mysql server over ssh in php ¬†using -'php,mysql,ssh'
i read one post regarding this topic, i also want to do the same,
i have my database on remote linux machine, and i want to connect using ssh and php funcitons,(i am currently using ssh2 library for that)
i tried using mysql_connect, but it gives me cant access (although i have granted permission)
when i tried using this function:
$connection = ssh2_connect('SERVER IP', 22);
ssh2_auth_password($connection, 'username', 'password');
$tunnel = ssh2_tunnel($connection, 'DESTINATION IP', 3307);
$db = mysqli_connect('127.0.0.1', 'DB_USERNAME', 'DB_PASSWORD',
¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†'dbname', 3307, $tunnel)
¬†¬†¬†¬†or die ('Fail: '.mysql_error());
i got error"mysqli_connect() expects parameter 6 to be string, resource given", can anyone please help me on this
Sep 7, 2015
to add a comment.
Related Hot Questions
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please