There is a server with MySQL , and you need to connect to it on a client created in php devel studio . I want to make a connection via ssh tunnel, on Unix this can be done like this:

 shell_exec("ssh -f -L 127.0.0.1:3307:127.0.0.1:3306 user@remote.rjmetrics.com sleep 60 >> logfile"); $db = mysqli_connect("127.0.0.1", "sqluser", "sqlpassword", "rjmadmin", 3307); 

But the client will work on Windows, how can you do the same without using additional prog? Or maybe there is some component in devel studio for this purpose?

  • one
    just to the word: ssh is quite a “extra” program. - aleksandr barakin 8:55
  • I agree, but by them I mean Putty, and everything else - venom1_
  • Look better Bitvise SSH Client . In my opinion for such pieces much steeper than some putty. - Sergey

1 answer 1

putty can be used from the windows command line, something like this:

 shell_exec("putty.exe -ssh user@remote.rjmetrics.com -L 127.0.0.1:3307:127.0.0.1:3306");