12

Many Windows MySQL tools like Navicat or EMS have this thing - You just put a PHP file on a shared hosting and can connect local running program to the remote MySQL server on the Web via the web service exposed by that php file.

Are there any good popular free solutions to expose full MySQL as a web service using PHP?

Ivan
  • 63,011
  • 101
  • 250
  • 382
  • To clarify, are you referring to a web-based DBMS? – Christian Mann May 23 '10 at 00:03
  • Yes, probably we can say it so. But I neither need any special simplistic HTTP DBMS-es nor local storage. I need a full-featured transactional relational DBMS (like MySQL InnoDB, PostgreSQL or MS SQL Server) to be exposed by PHP or Ruby to be accessed from client side over the Web via HTTP. – Ivan May 23 '10 at 05:46

4 Answers4

6

SQLyog's HTTP Tunnel is a very decent one.

enter image description here

Jacob
  • 2,041
  • 14
  • 16
Alix Axel
  • 151,645
  • 95
  • 393
  • 500
5

You can use TCP/IP over SSH from within MySQL Workbench and SQLyog without the need for PHP tunnelling script if you have SSH access to you server.

I have had customer sites on shared hosts where this doesn't work due to server configuration which is out of my control. I have overcome this restriction via SSH tunnelling which has the added benefit of being encrypted (Obviously this will only work if you have SSH access to the host however), although noted, the original post asked for a HTTP tunnel.

To setup SSH Tunnelling in SQLyog, on the MySQL tab for your connection, enter you MySQL credentials as you normally would for a local user on the host (replace 'root' and password with something secure and sensible):

MySQL Configuration

And then under the SSH tab, enter your terminal login details (username, password and port# if not 22):

SSH Configuration

Then save your connection.

The process is similar in MySQL workbench so shouldn't be hard to figure it out.

frijj2k
  • 161
  • 1
  • 6
  • 2
    Waht does it adds to the currectly accepted answer? – Yaroslav Nov 12 '12 at 14:20
  • 1
    The accepted answer is to use a HTTP tunnel via SQLyogTunnel.php script. I have had customer sites on shared hosts where this doesn't work due to server configuration which is out of my control. I was suggesting to use SSH tunnelling which has the added benefit of being encrypted (Obviously this will only work if you have SSH access to the host however), although noted, the original post asked for a HTTP tunnel. – frijj2k Nov 12 '12 at 20:56
  • Good comment, add it on your answer – Yaroslav Nov 12 '12 at 21:32
2

try use HTTPtunnel GNU. here example connection to MySQL using HTTPtunnel GNU.

Zoitc2014
  • 299
  • 1
  • 8
  • 1
    Thanks, but the good software is HTTPTunnel from http://http-tunnel.sourceforge.net, not the gnu HTTPTunnel from http://www.nocrew.org/software/httptunnel.html – diyism Oct 11 '12 at 08:58
  • @diyism did you manage to make it work? – Vic Seedoubleyew Dec 30 '18 at 23:11
  • The example link is dead. Anybody knows about exampless of how to use this tool with modern vesions of PHP? Thanks – abu Mar 02 '22 at 07:51
1

I have build a MySQLTunnel script in PHP, and put it in sourceforge. You can download it and try. It supports:

  • HTTP Tunneling to MySQL
  • JSON Resultset
  • On-demand compression to preserve bandwidth
  • On-demand encryption using AES-128 or AES-256 to preserve secure data and password
  • Supports both http:// and https://
  • Written in PHP can be installed on any LAMP or WAMP stack
  • Fast and secure communication

Here you can find it

Hope it helps

Freakyuser
  • 2,774
  • 17
  • 45
  • 72
  • Thanks for sharing! Just to make sure I understand: since it returns json, it can't be used directly by pointing its url to a database connector, right? One would need to write specific code to send requests and parse responses, right? – Vic Seedoubleyew Dec 30 '18 at 23:13
  • Yes, you are correct. On the client side you need to send http(s) requests and get back JSON resultsets than needs to be parsed. But this would be an easy routine in any language. I myself have used this tunnel in PHP, Delphi and Java (Android) applications. – Athanasios Alekizoglou Jan 02 '19 at 07:22
  • Thanks a lot for the swift reply! I agree that this would be easy. The downside I see is that it creates a tight coupling between the using code and the implementation. If one later changes database, and ends up not needing a tunnel, one has to rewrite user code, instead of just changing the database host and port. – Vic Seedoubleyew Jan 02 '19 at 13:52
  • 2
    This is not a tunnel. The point of a tunnel/proxy is that you can use the SQL client of your choice *as if* you're connecting directly to the host. – Mud Feb 18 '19 at 17:15