Install phpMyAdmin

Synopsis:

phpMyAdmin is an open source tool written in PHP intended to handle the administration of MySQL over the World Wide Web. It can perform various tasks such as creating, modifying or deleting databases, tables, fields or rows; executing SQL statements; or managing users and permissions.

I. Installing phpMyAdmin from Ports.

Log into the Freebsd system as root. (Assumes networking is already configured.)

#
# cd /usr/ports/databases/phpmyadmin && make install clean
#

┌────────────────┤phpMyAdmin-php82-4.9.11_1├───────────────┐
│ 'F1' for Ports Collection help.                          │
│ ┌──────────────────────────────────────────────────────┐ │
│ │new [X] BZ2      PHP bzip2 library support            │ │
│ │new [ ] CURL     PHP curl support                     │ │
│ │new [X] GD       PHP GD library support (requires X11)│ │
│ │new [ ] GMP      PHP GMP library support              │ │
│ │new [X] MBSTRING PHP Multi-byte String support        │ │
│ │new [ ] OPCACHE  PHP Opcache support                  │ │
│ │new [ ] SODIUM   PHP libsodium support                │ │
│ │new [X] ZIP      PHP Zip compression support          │ │
│ │new [X] ZLIB     PHP ZLIB support                     │ │
│ └──────────────────────────────────────────────────────┘ │
├──────────────────────────────────────────────────────────┤
│                   [  OK  ]     [Cancel]                  │
└──────────────────────────────────────────────────────────┘
PDF may be added to options, then tab to 'OK' and press [Enter].

Now the actual installation will proceed. The process takes around 10 minutes to compile and install the program on a Celeron 1.6G system.

II. Configuration
By default, phpMyAdmin will be installed into:

/usr/local/www/phpMyAdmin

1. Create and edit config.inc.php.
#
# cd /usr/local/www/phpMyAdmin
# vi config.inc.php
#

Copy and paste the following into the config.inc.php file. Make sure to put a 16 digit random hexidecimal number into the blowfish secret (shown as 0123456789abcdef below). Save and exit.
hint: search Google for a free online blowfish secret generator

<?php
$i = 0;
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
$cfg['blowfish_secret'] = '0123456789abcdef';
$cfg['DefaultLang'] = 'en';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
2. The owner and group of this file will already be root:wheel.Change the mode
of the configuration file to write protect it.
#
# chmod 444 config.inc.php
#
3. Setup the alias in Apache.

To make phpMyAdmin available through your web site, you should add something like the following to /usr/local/etc/apache24/httpd.conf under:

<IfModule alias_module>

        # Alias /webpath /full/filesystem/path
add just before </Directory>:
    Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"

    <Directory "/usr/local/www/phpMyAdmin/">
        Options None
        AllowOverride Limit
        Require ip 192.168.1.0/24
        # Require all granted
    </Directory>   

Note: Require ip 192.168.1.0/24 will restrict access to only the internal LAN network. Require all granted will open up phpMyAdmin to an outside network. Choose only one.
Restart Apache if httpd.conf is modified.

#
# service apache24 restart
#
phpMyAdmin will now be available from your webserver:

http://www.yourdomain/phpmyadmin/