Installing phpPgAdmin on Freebsd 13.

I installed phpPgAdmin, then I wrote down my notes so I wouldn't forget what I did. And now you're reading them

I got some of this info from linuxhint.com1 and linuxhelp.com2 tutorials. Neither one was complete. This also assumes that you already have postgreSQL installed.

Start by installing the databases/phppgadmin. Your favorite package manager should install www/apache24 and lang/php81, but it will not install www/mod_php81, so you should install that as well.

I'm using the default unmodified php.ini, which you can install by going to /usr/local/etc and copying php.ini-production to php.ini (you will need superuser powers to do this).

# cd /usr/local/etc
# cp php.ini-production php.ini

Test that PHP works by starting the php_fpm service. service php-fpm onestart. If there are no errors, continue configuring Apache by telling it what to do with php files. Create a file in /usr/local/etc/apache24/modules.d. You can call this file anything you want as long as it starts with three digits and an underscore. I called mine 001_mod-php.conf and filled it with the following


<IfModule dir_module>
DirectoryIndex index.php index.html

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

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


Test that Apache works by starting the apache24 service. service apache24 onestart. You can also test if Apache is properly interpreting PHP files by creating one in the Apache's DocumentRoot folder, which is /usr/local/www/apache24/data by default. This file can have any PHP commands you want in it, but the classic test is by using phpinfo.

<?php phpinfo(); ?>

If you open up your favorite web browser and go to http://localhost/test.php you should see a lot of info that you probably don't care about. If you just see the contents of the php file, then Apache is not actually processing php files correctly.

Next we need to tell Apache where the phpPgAdmin application is. To do this, we can make a symbolic link in our data folder.

# ln -s /usr/local/www/phpPgAdmin /usr/local/www/apache24/data

Now we can point our web browser to http://localhost/phpPgAdmin. If you see the phpPgAdmin page, then you're ready to go. You probably want to enable the apache24 and php_fpm services so that they start up on reboot. You also probably want to add a user to PostgreSQL so you can log in to phpPgAdmin. You also probably want to secure your server if you're using this in a production environment. But that's another article.

Read more articles ยท Go back to the homepage