This may seem a bit lengthy, but it worked for me without any error.
At first, Install phppgadmin from Ubuntu Software Center.
Then run these steps in terminal.
sudo apt-get install libpq-dev python-dev
pip install psycopg2
sudo apt-get install postgresql postgresql-contrib phppgadmin
Start the apache server
sudo service apache2 start
Now run this too in terminal, to edit the apache file.
sudo gedit /etc/apache2/apache2.conf
Add the following line to the opened file:
Include /etc/apache2/conf.d/phppgadmin
Now reload apache. Use terminal.
sudo /etc/init.d/apache2 reload
Now you will have to create a new database. Login as 'postgres' user. Continue in terminal.
sudo su - postgres
In case you have trouble with the password of 'postgres', you can change it using the answer here https://stackoverflow.com/a/12721020/1990793 and continue with the steps.
Now create a database
createdb <db_name>
Now create a new user to login to phppgadmin later, providing a new password.
createuser -P <new_user>
Now your postgressql has been setup, and you can go to:
http://localhost/phppgadmin/
and login using the new user you've created, in order to view the database.