Hello there. Welcome once again to our tutorial on how to Install phpMyAdmin with Nginx on FreeBSD 12. In our previous guide, we learnt how to Install phpMyAdmin with Apache on FreeBSD 12.
Install phpMyAdmin with Nginx on FreeBSD 12
Ensure that FEMB stack is up and running on your FreeBSD 12 server. You can kindly follow our previous link on how Install Nginx, MySQL, PHP (FEMP) Stack on FreeBSD 12.
Install the following required PHP extensions if not already installed in the above guide.
pkg install php72-mysqli php72-json php72-mbstring php72-session php72-hash
Once the above prerequisites are met, please proceed as follows;
phpMyAdmin is usually available on most systems’ default repositories and hence can be easily installed using the respective system package manager. However, the package may not be up-to-date in terms of latest features support. In such a case, you can download latest version of phpMyAdmin from the downloads page and move it to your Nginx web root directory for installation.
Install phpMyAdmin on FreeBSD 12
Verify that the latest version of phpMyAdmin, version 4.8.4, with support for PHP 5.6 to 7.2 and MySQL version 5.6 and newer is available on default FreeBSD 12 repos.
pkg search phpmyadmin
phpMyAdmin-php56-4.8.4 Set of PHP-scripts to manage MySQL over the web phpMyAdmin-php70-4.8.4 Set of PHP-scripts to manage MySQL over the web phpMyAdmin-php71-4.8.4 Set of PHP-scripts to manage MySQL over the web phpMyAdmin-php72-4.8.4 Set of PHP-scripts to manage MySQL over the web
Well, since it seems we are good to do phpMyAdmin installation from the repos, run the command below;
pkg install phpMyAdmin-php72-4.8.4
phpMyAdmin is installed into the following directory
Rename phpMyAdmin configuration file as shown;
Create a symbolic for phpMyAdmin installation directory to Nginx web server root directory as follows;
ln -s /usr/local/www/phpMyAdmin/ /usr/local/www/nginx-dist/phpmyadmin
If you can verify;
ls -l /usr/local/www/nginx-dist/phpmyadmin lrwxr-xr-x 1 root wheel 26 Jan 2 17:46 /usr/local/www/nginx-dist/phpmyadmin -> /usr/local/www/phpMyAdmin/
Create a blowfish secret required for cookie based authentication to encrypt password in cookie. You can generate the secret online and paste as follows;
... /** * This is needed for cookie based authentication to encrypt password in * cookie. Needs to be 32 chars long. */ $cfg['blowfish_secret'] = '$2a$07$ToE69yqEaQCoWwWCQAOULOLu8PnrHzu6lflq1v1qkCHuIa7kP6s9q'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ /** * Servers configuration */ ...
Restart Nginx and PHP-FPM for the changes to take effect.
service nginx restart service php-fpm restart
To access phpMyAdmin dashboard, navigate to the browser and enter the URL in the format,
http://server-IP/phpmyadmin. This will take you to phpMyAdmin login page.
Login with MySQL database root credentials.
If you are running MySQL 8.0 then you might have an issue with logging in to phpMyAdmin dashboard, see the error below. Note that MySQL 8.0 is using
caching_sha2_password rather than
mysql_native_password as the default authentication plugin which phpMyAdmin may not understand.
As a work around, login to your MySQL as root user and run the command below to change the Authentication Plugin for the root user to
mysql_native_password as shown below;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[email protected]3W0rd';
Restart MySQL and go back to the browser and login to your phpMyAdmin dashboard.
Great. That is all it takes to install phpMyAdmin with Nginx on FreeBSD 12. Enjoy!
You can also check our previous articles on LAMP/LEMP Stack using the following links;