Skip to content
Felipe Figueroa edited this page May 25, 2020 · 1 revision

Configuring servers

Your phpPgAdmin6 installation will need at least one server to connect to. They must be defined in your config file (refer to config.inc.php-dist for an example).

$conf['servers'] is meant to hold an array of server definitions. The next section explains the meaning of its available properties.

Properties of a server definition

Each server definition has the form:

 // $server_index starts at zero and it's incremented for each additional server block
 $server_index=0;
 $conf['servers'][$server_index] = [
    // Display name for the server on the login screen
    'desc'            => 'PostgreSQL',

    // Hostname or IP address for server.  Use '' for UNIX domain socket.
    // use 'localhost' for TCP/IP connection on this computer
    'host'            => '',

    // Database port on server (5432 is the PostgreSQL default)
    'port'            => 5432,

    // Database SSL mode
    // Possible options: disable, allow, prefer, require
    // To require SSL on older servers use option: 'legacy'
    // To ignore the SSL mode, use option: 'unspecified'
    'sslmode'         => 'prefer',

    // Change the default database only if you cannot connect to template1.
    // For a PostgreSQL 8.1+ server, you can set this to 'postgres'.
    'defaultdb'       => 'template1',

    // tell phpPgAdmin6 tree panel not to crawl system or restricted databases
    'hiddendbs'       => ['rdsadmin', 'postgres']

    // Specify the path to the database dump utilities for this server.
    // You can set these to '' if no dumper is available.
    'pg_dump_path'    => '/usr/bin/pg_dump',
    'pg_dumpall_path' => '/usr/bin/pg_dumpall',

    'theme' => ['default' => 'default']
];

A second server could be, for example: (this time using PostgreSQL for Windows)

$server_index++;
$conf['servers'][$server_index] = [
   'desc'=> 'Test Server',
   'host'=> '127.0.0.1',
   'port'=> 5432,
   'sslmode'=> 'allow',
   'defaultdb'=> 'template1',
   'pg_dump_path'=> 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dump.exe',
   'pg_dumpall_path'=> 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dumpall.exe'
];

Groups definition

Groups allow administrators to logicaly group servers together on the left tree panel

// First group
$conf['srv_groups'][0] = [
   'desc'=> 'my first 3 servers',
   // server indexes, separated by comma
   'servers' => '0,1,2'
];

// Second group
$conf['srv_groups'][1] = [
   'desc'=> 'my other 2 servers',
   'servers' => '3,4'
];

A server can belong to any number of groups

$conf['srv_groups'][2] = [
   'desc'=> 'servers with odd index',
   'servers' => '1,3'
];

A group can be nested in one or more existing groups using the 'parents' parameter. Here the group 'group three' contains only one server and will appear as a subgroup in both 'group one' and 'group two':

$conf['srv_groups'][2]['desc'] = 'group three';
$conf['srv_groups'][2]['servers'] = '4';
$conf['srv_groups'][2]['parents'] = '0,1';

** Warning: Only groups with no parents appears at the root of the tree. **

Applying themes on a server basis

You can apply specific theme depending on servers, users and databases

The priority order is :

  1. the theme defined for a server
/* Example for servers */
$conf['servers'][0]['theme']['default'] = 'default';
  1. the theme defined for a database takes precedence over the server theme
/* Example for databases */
$conf['servers'][0]['theme']['db']['specific_db'] = 'default';

3.- the theme defined for a user takes precedence over the database theme (*) I'm not sure this is actually working 🤷

/* Example for users */
$conf['servers'][0]['theme']['user']['specific_user'] = 'default';