|
Posted by ZeldorBlat on 09/12/07 20:23
On Sep 12, 4:00 pm, mtuller <mitul...@gmail.com> wrote:
> I would like to encrypt data passed between my web server and the
> database server. I have looked all over, but don't see any information
> on how to connect to mysql via ssh with php. Is it possible?
You want to use SSH tunneling to do this. Basically, suppose PHP is
running on hostA and MySQL is running on hostB. You then SSH from
hostA to hostB like this:
ssh -L 3306:hostB:3306 hostB
What this says is "From hostA ssh to hostB. When you do that, make
port 3306 on hostA forward everything over to port 3306 on hostB."
Finally you tell PHP to connect to use localhost (hostA) as it's
database server and it should just magically work.
You can even set up the SSH connection on a different machine. So,
from hostC you would do:
ssh -L *:3306:hostB:3306 hostB
And then configure PHP to use hostC as it's database server.
Navigation:
[Reply to this message]
|