PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > php connect to mysql via ssh
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
php connect to mysql via ssh

Réponse
 
LinkBack Outils de la discussion
Vieux 12/09/2007, 21h00   #1 (permalink)
mtuller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut php connect to mysql via ssh

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?

  Réponse avec citation
Vieux 12/09/2007, 21h23   #2 (permalink)
ZeldorBlat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: php connect to mysql via ssh

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.

  Réponse avec citation
Vieux 12/09/2007, 21h26   #3 (permalink)
Andy Hassall
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: php connect to mysql via ssh

On Wed, 12 Sep 2007 20:00:33 -0000, mtuller <mituller@gmail.com> wrote:

>I would like to encrypt data passed between my web server and the
>database server.


How about:

http://www.php.net/manual/en/function.mysql-connect.php

client_flags, MYSQL_CLIENT_SSL

>I have looked all over, but don't see any information
>on how to connect to mysql via ssh


Well, you could set up an SSH tunnel for the relevant port (3306, using the -D
flag, or use stunnel or something else like that) and run the standard
(unencrypted) MySQL protocol through the encrypted tunnel, but that's another
step on top of just using the built-in SSL support (assuming a non-ancient
version of MySQL, and that it works as advertised anyway).

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
  Réponse avec citation
Vieux 13/09/2007, 04h26   #4 (permalink)
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: php connect to mysql via ssh

mtuller 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?
>


Try a MySQL newsgroup, such as comp.databases.mysql. MySQL has to be
set up for this communication.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
Vieux 08/10/2007, 17h05   #5 (permalink)
mtuller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: php connect to mysql via ssh

I am not trying to connect via SSL, I want to tunnel through SSH.

On Sep 12, 10:26 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> mtuller 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?

>
> Try a MySQL newsgroup, such as comp.databases.mysql. MySQL has to be
> set up for this communication.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================



  Réponse avec citation
Vieux 08/10/2007, 22h14   #6 (permalink)
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: php connect to mysql via ssh

mtuller wrote:
> I am not trying to connect via SSL, I want to tunnel through SSH.
>
> On Sep 12, 10:26 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> mtuller 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?

>> Try a MySQL newsgroup, such as comp.databases.mysql. MySQL has to be
>> set up for this communication.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================

>
>


You still need to be in a MySQL newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h06.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12138 seconds with 14 queries