Database Abstraction Layer for PHP

User Tools

Site Tools


ADOdb Proxy Server

This functionality is deprecated as of ADOdb 5.21.0 and will be removed in 5.22.0. It could be reinstated, if the community contributes with necessary security enhancements, as discussed on Github.


The ADOdb Proxy server provides a simple method of extending a database connection to provide a simple REST server via http. It provides a limited number of ADOdb commands that can be executed across an http channel against any supported database.

Security warning - use with extreme caution ! Depending on how it is setup, this feature can potentially expose the database to attacks, particularly if used with a privileged user account.

Server Side Usage

  • The machine that acts as a database server must have a PHP configuration installed that allows it to serve PHP connections to the necessary database.
  • The http server must have a CGI configuration defined that allows it to serve PHP requests.
  • A single program is provided that acts as a server side dispatcher, server.php. Up to ADOdb version 5.21, this program cannot be moved from the /adodb directory. This program must be modified in-situ to provide the database connection necessary.

Modify the server.php as required to provide a database connection

 * Define the IP address you want to accept requests from
 * as a security measure. If blank we accept anyone
 * Connection parameters
$driver = 'mysqli';
$host = 'localhost';
$uid = 'proxy';
$pwd = 'proxy';
$database = 'employees';

Client Side Usage

Configuration of the client side differs only slightly from the normal ADOdb configuration. For information about the client side driver, see Proxy Client

include '../adodb-master/';
* We must manually include the driver that is used on the server side. This is
* so that database specific objects can be correctly interpreted on the client
* side
include '../adodb-master/drivers/';
$db = ADOnewConnection('proxy');
* Connection honors $ADODB_FETCH_MODE, but not $db->setFetchMode();
* define a connection directly to the server program
$url = '';
* Create a connection
* Create an SQL command
$sql = "SELECT * FROM employees";
* Execute and treat exactly the same as a normal ADOdb result set
$result = $db->selectLimit($sql,1,10);
while ($r = $result->fetchRow())


  • Access currently limited to http protocol
  • No access to meta functions
  • No rollback or transactional control
  • No parameter binding allowed
  • server.php must be modified in-situ
v5/proxy/proxy_index.txt · Last modified: 2021/08/22 13:17 by dregad