Install PhpPgAdmin On CentOS 7 And Ubuntu 15.10

PhpPgAdmin

PhpPgAdmin is a web application which is used to administer PostgreSQL databases. This project is an extension of PhpMyadmin and it was developed to ensure that all the features which are available to Mysql users are also available to PostgreSQL database users. It’s a very powerful open source tool which brings ease and flexibility to PostgreSQL lovers and currently it supports all the popular operating systems. Most recently,  PostgreSQL community has really been active in order to provide better support for their product. Design changes and depreciation of less used functions have been performed to optimize the performance of the product. The product was first developed as an enhancement of PhpMyadmin but later on in 2002 the code was done from scratch and is using a totally independent code base and is not dependent on PhpMyadmin in anyway. Let’s review its features and installation process for popular Linux distributions CentOS and Ubuntu.

Features

Major features of PhpPgAdmin are as follows:

  •  It can administer multiple PostgreSQL servers.
  • Support for PostgreSQL 9.x is available.
  • Complete scope for creation of users, databases, tables, triggers, views and various reports is covered.
  • Easy manipulation of data in the tables.
  •  Pg_dump, CSV, Tabbed and various other dump formats available to pefrom backup and restore operations.

Installation on Centos 7

You can easily install PhpPgAdmin on your Centos 7 sytem using yum utility. Package is normally present in the repos. You can use the following command to get it installed.

 yum install phpPgAdmin php-pgsql

PhpPgAdmin

The above screenshot shows the installation process for PhpPgadmin and all the related dependencies. As soon as it is installed, you have to make some configuration changes in order to access it from your browser to manage databases; otherwise you might land on “Forbidden” error page.

Configuration file of PhpPgAdmin is /etc/httpd/conf.d/phpPgAdmin.conf ; open this file in your favorite text editor and you should be seeing the following contents.

 Alias /phpPgAdmin /usr/share/phpPgAdmin
<Location /phpPgAdmin>
<IfModule mod_authz_core.c>
Require local
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1

In the above mentioned configuration, you can change the value of “Allow from” parameter to make it accessible for everyone or the user of your choice. Let’s see how to allow access to this web interface from all locations.

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

As you can see “Allow from all” directive has been modified, restart apache web server for the changes to take effect.

 systemctl restart httpd

Now, you can access the PhpPgAdmin by the following URL.

http://your-IP/phppgadmin

PhpPgAdmin

Install PhpPgAdmin on Ubuntu 15.10

Method to install PhpPgadmin on Ubuntu is nearly the same as of Centos; we just need to use apt-get here instead of yum. You can use the following command to install PhpPgAdmin on your Ubuntu 15.10 server.

 apt-get install postgresql postgresql-contrib phppgadmin

Confirm the installation process by typein “Y” when prompted and you should be good to go. It will take some time depending upon your internet connection. Now same as you have done for Centos, make sure to edit /etc/apache2/conf-available/phppgadmin.conf file to allow access for your desired locations. Once done, simply restart apache web server.

 /etc/init.d/apache2 restart

Conclusion

It is a powerful, object-relational database management system which makes working with PostgreSQL  databases a piece of cake. You can create, edit, backup, restore your databases within couple of clicks. It is written in PHP and language and requires apache web server on the front end. Since the popularity of PostgreSQL  is sky rocket these days, PhpPgAdmin is catering the need of large number of web application developers.