How to setup phpPgAdmin on CentOS


Suppose that we have a server with nginx and php-fpm installed.

Step 1:

cd /home/vpssim.demo/public_html
git clone https://github.com/phppgadmin/phppgadmin.git

Result:

[root@tutorialspots ~]# cd /home/vpssim.demo/public_html
[root@tutorialspots public_html]# git clone https://github.com/phppgadmin/phppgadmin.git
Cloning into 'phppgadmin'...
remote: Counting objects: 16966, done.
remote: Total 16966 (delta 0), reused 0 (delta 0), pack-reused 16966
Receiving objects: 100% (16966/16966), 12.21 MiB | 3.76 MiB/s, done.
Resolving deltas: 100% (10356/10356), done.

Step 2: create PostgreSQL user

First login as the postgres user

sudo su postgres

Lets create a new postgres role (user)

createuser -P --interactive

Result:

[root@tutorialspots public_html]# sudo su postgres
bash-4.2$ createuser -P --interactive
Enter name of role to add: admin
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
bash-4.2$

Step 3: Copy conf/config.inc.php-dist to conf/config.inc.php and edit appropriately

Now you can goto phppgadmin, e.g:

http://xx.xx.xx.xx/phppgadmin/

phppgadmin

If you see error:

Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option.

You must install php-pgsql: How to install php-pgsql on CentOS

If you can’t login phppgadmin, you must edit file: /var/lib/pgsql/data/pg_hba.conf

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

Then restart service postgresql.

Leave a Reply