Here is the step by step instructions on how to install phpPgAdmin on Centos 7. PostgreSQL is a great database and phpPgAdmin is a web-based administration tool for PostgreSQL. Probably most postgresql DBA's will use the command line or pgadmin3 but if you are like me, using postgresql in a vps webserver somewhere then phpPgAdmin is a great timesaver tool.

Install the required packages.

You need to have epel repository available on your server.

yum -y install epel-release

In this section we are going to assume you are using the default http server and php packages that comes with CentOS 7. the command below will install phpPgAdmin including php and the webserver. If the default httpd and php are already installed then the command will simply skip them.

yum -y install php-pgsql httpd php

Install Latest Version of phpPgAdmin

The previous version of this howto directed the user to install phppgadmin via RPM. This however works only if you are using an older version of postgresql. Otherwise you will get the dreaded message *Does not support version. Upgrade to a newer version of phpPgAdmin**. We shall therefore install by downloading a newer version of phppgadmin and put it in /var/www/html.

Download and Uncompress phpPgAdmin

cd /var/www/html
tar -jxvf phpPgAdmin-5.6.0.tar.bz2 ; mv phpPgAdmin-5.6.0 phpPgAdmin

Configure phpPgAdmin to connect to your local postgresql database

Edit /etc/phpPgAdmin/ file, we have to modify the admin file to enable the browser access.

vi /var/www/html/phpPgAdmin/conf/

Add the localhost in the following server parameter.

$conf['servers'][0]['host'] = 'localhost';

If extra login security is true, then logins via phpPgAdmin with no password or certain usernames (pgsql, postgres, root, administrator) will be denied. To enable the postgres login, change it to false.

$conf['extra_login_security'] = false;

To simply hide other databases in the list make following condition to true – this does not in any way prevent your users from seeing other database by other means.

$conf['owned_only'] = true;

Allow Apache/PHP to be able to connect to database if using selinux .

If selinux is enabled then you need to set selinux to allow httpd to connect to your database via network sockets.

setsebool -P httpd_can_network_connect_db on
setsebool -P httpd_can_network_connect on

Configuring PostgreSQL:

phpPgAdmin connects to the local postgresql server via network. We have to configure our postgresql server to accept local connections via md5 authentication.

vi /var/lib/pgsql/9.3/data/pg_hba.conf

Please enter the value as per your requirements inIPv4 and Ipv6 connections and make sure it accepts md5 passwords.

# IPv4 local connections:
host    all             all               md5
host    all             all            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Configuring Apache:

Create the following config file in /etc/httpd/conf.d/phpPgAdmin.conf

vi /etc/httpd/conf.d/phpPgAdmin.conf
Alias /phpPgAdmin /var/www/html/phpPgAdmin

<Location /phpPgAdmin>
    <IfModule mod_authz_core.c>
        # Apache 2.4
        #Require local
	Require all granted
        #Require host
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Deny from all
        Allow from
        Allow from ::1
        # Allow from

Restart the services.

systemctl restart postgresql-11.service
systemctl restart httpd.service

Congratulations you have installed phpPgAdmin

You can now browse to your server IP via a browser and you should get the following page:

The login page.

After successfull login.