Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install phpPgAdmin on Ubuntu 24.04

Manage PostgreSQL in the browser: install Apache, PHP, PostgreSQL and phpPgAdmin.

Databases2 min read12 screenshots
Note: phpPgAdmin is an older project and does not always work with the newest PHP and PostgreSQL versions. If you have problems, try pgAdmin 4 (web mode) as a modern alternative.

Step 1: Update the system

sudo apt-get update -y && sudo apt-get upgrade -y
Updating the system

Step 2: Install Apache

sudo apt install apache2 -y
Installing Apache
sudo systemctl enable apache2.service && sudo systemctl start apache2.service
Enabling Apache
sudo systemctl status apache2.service
The Apache status

Step 3: Install PHP and the extensions

Ubuntu 24.04 ships PHP 8.3. Use the version that your system has:

sudo apt install php php-cli php-common php-xml php-zip php-mbstring php-curl libapache2-mod-php -y
Installing PHP
php -v
The PHP version

Step 4: Install PostgreSQL

sudo apt install postgresql postgresql-client -y
Installing PostgreSQL
sudo systemctl enable postgresql.service && sudo systemctl start postgresql.service
Starting PostgreSQL
sudo systemctl status postgresql.service
The PostgreSQL status

Step 5: Install phpPgAdmin

sudo apt install phppgadmin php-pgsql -y
Installing phpPgAdmin and the PHP PostgreSQL module

Open its configuration file (/etc/phppgadmin/config.inc.php) and set:

$conf['extra_login_security'] = true;
$conf['owned_only'] = true;
Editing config.inc.php
  • extra_login_security blocks logins of users without a password and some default accounts such as postgres.
  • owned_only shows only the databases that the user owns.

To use the postgres account in phpPgAdmin, set a password for a normal user with CREATE ROLE, and log in with that user.

Step 6: Configure Apache for phpPgAdmin

The package normally adds /etc/apache2/conf-available/phppgadmin.conf. Enable it:

sudo a2enconf phppgadmin
sudo systemctl reload apache2

If you need to restrict access, edit the file and use Require ip YOUR_IP inside the <Directory /usr/share/phppgadmin> block. By default, phpPgAdmin may allow localhost only.

Step 7: Open phpPgAdmin

Go to http://your_server_ip/phppgadmin in your browser, and log in with a PostgreSQL user.

The phpPgAdmin login page

What you can do

  • Manage database objects: create, change and delete databases, tables and views.
  • Run SQL in the query tool.
  • Back up and restore databases.
  • Manage users and roles.
  • Use PostgreSQL extensions.
  • Use many languages.
Warning: Do not leave phpPgAdmin open to the whole internet. Restrict it by IP address, use HTTPS and strong passwords.

Quick recap

  • Install Apache, PHP, PostgreSQL and phppgadmin.
  • Enable extra_login_security and owned_only.
  • Open /phppgadmin.