Chapter 6. phpPgAdmin

Installing the pgpPgAdmin tool is NOT straightforward, due to the somewhat weird authentication scheme in PostgreSQL.

To begin, we install the package:


apt-get install phppgadmin

When I install I chose to automatically configure Apache. This will leave a line in the main configuration file /etc/apache/httpd.conf :


include /etc/phppgadmin/apache.conf

Since I want phpPgAdmin to be available only in the admin site, I remove the line from the main file, and add it to the virtual server admin.

Next we change the configuration file for phpPgAdmin, /etc/phppgadmin/config.inc.php, as there is some things that should be changed to match the setup of the server.


$cfgUserDatabases = false;

$cfgServers[1]['host'] = '192.168.228.14'

What was done here, was that instead of localhost, we use an IP address on the internal network. This is done because of the permissions on the database server.

The other thing that was done is to show all accessible databases, and not just the ones owned by the user. In my setup, there is NO owner used databases in the PostgreSQL server. Access to the users database is taken care of by the PostgreSQL authentication functions.

To make it all work, we also need to give password access to the template1 database. This is done in the file /etc/postgres/pg_hba.conf where we add the line:


host         template1   192.168.228.0 255.255.255.0       md5

And we should now be ready to go...