Ver original$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());