Using phpPgAdmin on FreeBSD with Apache24 Web Server

phpPgAdmin is almost the same as PhpMyAdmin, phpPgAdmin is used together with PostgreSQL while PhpMyAdmin is used together with MySQL, which means phpPgAdmin allows you to access and manage databases that are relied on on websites more easily when used together with a web browser. If we use a PostgreSQL database, then phpPgAdmin must be the management tool of choice that cannot be separated from the PostgreSQL database. Like PhpMyAdmin, phpPgAdmin is also PHP-based and is used to make creating and managing databases as simple as possible, even for users who don't have much experience doing so.

Indirectly, the relationship between phpPgAdmin and PostgreSQL is the same as the relationship between phpMyAdmin and MySQL. More specifically, phpPgAdmin is a web-based utility or software that allows users to manage PostgreSQL databases very easily. The phpPgAdmin application can be opened in a web browser as a regular page and will work the same regardless of the operating system used.

As the name suggests, phpPgAdmin is written using PHP and has various easy-to-use features for managing PostgreSQL databases. If we have used phpMyAdmin before, the phpPgAdmin interface will feel familiar to users, because the look and feel of the graphic GUI is inspired by phpMyAdmin.

Through phpPgAdmin, you can view information stored in tabular form, create new notes, edit existing ones, and delete those that are no longer needed. Additionally, you have advanced sorting and filtering features at your disposal. That said, perhaps phpPgAdmin's greatest strength is its support for Structured Query Language (SQL).

This article will try to review the phpPgAdmin application complete with installation and configuration methods. In writing this article, phpPgAdmin was run on a FReeBSD 13.2 server computer which proved to be stubborn and stable.

1. System Specifications

OS: FreeBSD 13.2
IP Address:
Apache Version: Apacje24
PHP Version: PHP82
PHP mods and extensions
Postgresql version: postgresql15

1. Instalasi phpPgAdmin

Because phpPgAdmin is used to manage the PostgresQL database, there's no harm in checking first whether the PostgresQL application has been installed on the FreeBSD server before carrying out the installation.

root@ns1:~ # service -e

From the script above we can see that postgresql, apache24 and php-fpm have been installed, so we immediately continue by installing phppgadmin. Use the command below to install phpPgAdmin.

root@ns1:~ # cd /usr/ports/databases/phppgadmin
root@ns1:/usr/ports/databases/phppgadmin #
make install clean

2. Edit the php.ini file

In order for the PHP pgsql module to run together with PHP, the module must be activated. Edit the /usr/local/etc/php.ini file and remove the ";" which is at the front of the script. To edit the /usr/local/etc/php.ini file, we use the "ee" editor, here's how to activate the PHP pgsql module.

root@ns1:~ # ee /usr/local/etc/php.ini

The above command will activate the PHP pgsql module.

3. Edit the httpd.conf file

The httpd.conf file is a config file from the apache24 application, because phpPgAdmin runs on the apache24 web browser, we have to edit the httpd.conf config file so that phpPgAdmin can be opened in the Google Chrome or Yandex web browser. in the file /usr/local/etc/apache24/httpd.conf add the script "index.php" in the following line.

<IfModule dir_module>
DirectoryIndex index.html

After adding the "index.php" script, the results will be as below.

<IfModule dir_module>
DirectoryIndex index.php index.html

Then add the following script to the very bottom of the /usr/local/etc/apache24/httpd.conf file.

Alias /phpPgAdmin "/usr/local/www/phpPgAdmin/"
<Directory "/usr/local/www/phpPgAdmin">
AllowOverride None
Options None
Require all granted

Because in this article we use PHP-FPM, the following script must be disabled in the /usr/local/etc/apache24/httpd.conf file.

#<FilesMatch "\.php$">
# SetHandler application/x-httpd-php
#<FilesMatch "\.phps$">
# SetHandler application/x-httpd-php-source

4. Test phpPgAdmin

After all the above configurations have been completed and nothing has been missed, the next step is to carry out a TEST on the phpPgAdmin application. Before we do a test restart, the apache24 application must be installed so that all PHP and phpPgAdmin modules can be loaded by the apache24 web server.

root@ns1:~ # service apache24 restart
root@ns1:~ #
service php-fpm restart

Now we open the Yandex or Google Chrome web browser, in the address bar menu type "".

If it appears like the image above, it means that the phpPgAdmin application has been successfully installed on your server computer, and now we can do PostgreSQL work with a GUI display that can make it easier for us to edit, add, delete and so on for each table and database in PostgreSQL.
Iwan Setiawan

I Like Adventure: Mahameru Mount, Rinjani Mount I Like Writer FreeBSD

Post a Comment

Previous Post Next Post