473,224 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

PHP SSH and mysql connection

For a long time I've been trying to connect to mysql through a SSH tunnel. Although that si possible by setting up the tunnel manually (with 'ssh -L ...'), I'd like it to be done by PHP itself.

Now, with the SSH2 extension (http://www.php.net/manual/en/ref.ssh2.php) it is possible to issue a 'ssh2_connect' and then a 'ssh2_tunnel' command.
That returns a socket resource to the destination server.
So far, all fine.

How can I force that socket onto 'mysql_connect'?
I mean, what I have is:
$tunnel = ssh2_tunnel($connection, '', 12345);

But $tunnel is a PHP resource, and not in the format ':/path/to/socket' that mysql_connect expects...

Is this possible at all?

Jul 17 '05 #1
1 10255
*** Hendrik Maeder wrote/escribió (Wed, 29 Jun 2005 11:14:35 +0200):
How can I force that socket onto 'mysql_connect'? I mean, what I have is:
$tunnel = ssh2_tunnel($connection, '', 12345);

But $tunnel is a PHP resource, and not in the format ':/path/to/socket'
that mysql_connect expects...

According to manual mysql_connect() does not expect necessarily a socket
file (actually, ":/path/to/socket" support was added at a later time).

I haven't tried it myself with PHP so it's just a guess but... Once the
tunnel if open, can't you simply connect through it using host+port as
usual? The idea of a tunnel is that applications don't have to know about

-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
by: zMisc | last post by:
I am looking at using MySQL in my application (currently works with Access and SQL Server 2000). Is it possible to access MySQL database using ADO? What is the connection string for this? ...
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
by: Ike | last post by:
Let's say I have a MySQL 4.12 database, opened to the internet on allowing all incoming and outgoing ports. I have a username and password setup, which CAN connect to this database,...
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
by: tulika dutta | last post by:
after 8 hrs my MySQL connection with JDBC gets time out. It gives the error java.sql.SQLException: No operations allowed after connection closed.Connection was implicitly closed due to underlying...
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.