Phpmyadmin or Alternative for PHP7 + Nginx + MySql 5.7 + Ubuntu 16.04

September 19, 2016 456 views
Nginx MySQL PHP Ubuntu 16.04

Hello, I have been reading up on the tutorials and some of the comments on the community pages but I would like to know if there are any better alternatives or any advice to better manage my databases.

I use Phpmyadmin previously on an Apache and Php5 servers but recently deploying a new droplet, I cannot seem to install Phpmyadmin on my new droplet as it is saying that mcrypt has not been found etc.

So at this stage, I am looking for alternatives that can be installed on my droplet specifications or advice as to how I can upload/manage databases without using Shell access since I like using a GUI.

Thanks in advance.

1 Answer
xMudrii September 19, 2016
Accepted Answer

Phpmyadmin does support PHP 7 and Mysql 5.7.
I recommend you to grab latest release from their download page.
Current download link is:

Also, this is about on requirements (from their download page).
Current version compatible with PHP 5.5 to 7.0 and MySQL 5.5 and newer.

How to install:

Download PhpMyAdmin. You can do it using wget from your droplet.

  • wget

You will need to unpack it by using tar command:

  • tar xvf phpMyAdmin-4.6.4-all-languages.tar.gz

As you finished it, rename it to phpmydmin and move to /usr/share/.

  • mv phpMyAdmin-4.6.4-all-languages.tar.gz /usr/share/phpmyadmin

You installed phpmyadmin in /usr/share/phpmyadmin. Now it needs to be configured.

First install needed PHP dependencies - mcrypt and mbstring.

  • sudo apt-get install php7.0-mcrypt php-mbstring php7.0-mbstring php-gettext

This command will install it on your droplet, but keep in mind, only install, you need to enable it afterwards. To enable it execute following commands:

  • sudo phpenmod mcrypt
  • sudo phpenmod mbstring

Now restart PHP-FPM to make changes in effect.

  • sudo systemctl restart php7.0-fpm

As for nginx, making symbolic link from phpmyadmin to /var/www/html will finish it's job making available to nginx.

  • sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html

Now we need to change blowfish_secret in PHPMyAdmin config.
blowfish_secret is using to encrypt passwords in cookie. Recommended length is 32 chars.
First of all make file by copying its sample:

  • sudo cp /usr/share/phpmyadmin/ /usr/share/phpmyadmin/

Now open it with your favourite text editor (e.g. nano).

  • nano /usr/share/phpmyadmin/

Locate following line: $cfg['blowfish_secret'] = '';
Now enter your secret between '' and save file.

Last step is creating phpmyadmin database.
Go to http://droplet_ip/phpmyadmin.
Login to phpmyadmin.

You will see warning that phpmyadmin database is missing. You will have link which will take you to page with option to create database. Follow it, click OK, and wait until it finishes.

After that you have working phpmyadmin on NGINX and PHP7.0.

(Optional:) Enable Configuration Storage
By default, some of extra options such as change tracking, table linking, and bookmarking queries are disabled.
You need to enable it you should do following:
Open with text editor.

  • nano /usr/share/phpmyadmin/

Locate following lines:

// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

Uncomment it by removing // and set some username and password instead of pma (username) and pmapass (password). These are only placeholders.

Also be sure to uncomment following lines under Storage database and tables by removing //.

// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';

Now you need to create user for it. Go again to phpmyadmin and go to SQL.
Execute following query:
GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
This will create in same time create MySQL user and Grant needed privileges.

This is whole tutorial for seting up phpmyadmin. It should be fully working now.

About alternatives I can recommend you MySQL Workbench or HeidiSQL.
Both is applications that you install on your own PC, you don't install anything on droplet.
MySQL workbench works on Windows, Linux or OS X, while HeidiSQL works with Windows, but it can be run via wine on Linux.

If you get any problem, comment, I or somebody other will try to help you :)

  • Wow xMudrll!

    Thanks for your guide, I will surely test it out this evening. The part I always get stuck on is the sudo phpenmod mcrypt Part which says that the Command is not found.

    But will surely keep you updated.

    • phpenmod should be available if you followed DigitalOcean tutorial. It is installed by default.
      Make sure you have installed php-fpm.

      You can test your PHP installation if you didn't by creating phpinfo file.
      Create in your html directory (by default /var/www/html) info.php file.


      If PHP is working, you always phpenmod manually.
      You can check already enabled modules by executing php -m.
      Example output would be

      php -m
      [PHP Modules]

      mbstring and mcrypt are most important ones. If they are missing, enable them manually by creating symbolic link for them.
      These two commands will done your job

      • sudo ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.0/cli/conf.d/20-mycrypt.ini
      • sudo ln -s /etc/php/7.0/mods-available/mbstring.ini /etc/php/7.0/cli/conf.d/20-mbstring.ini

      Modules are installed in /etc/php/7.0/mods-available/. When installed by apt-get install they are not enabled, you must do it usually via phpenmod. If phpenmod is not enabled (this is rare) you must do it manually.
      Basically, phpenmod just create symbolic links from mods-available to /etc/php/7.0/cli/conf.d/
      So you have /etc/php/7.0/mods-available/mcrypt.ini and /etc/php/7.0/mods-available/mbstring.ini. These two commands will symlink it to /etc/php/7.0/cli/conf.d/20-mycrypt.ini for mycrypt and /etc/php/7.0/cli/conf.d/20-.ini for mbstring.

      If you execute php -m again, you must see them in PHP modules.

      Just little note: make sure you are typed phpenmod correctly and not php7enmod, php7.0enmod or even php5enmod. Command is phpenmod :)

      • Thank you once again.

        Just wanted to run by something with you to make sure.

        This snippet here:

        resolver valid=300s;

        Does the resolver mean my server ip address?

        This is a tutorial I am following: Link

        In the section: Create a Configuration Snippet with Strong Encryption Settings.

        Thank you in advanced. This might be why I am having problems with my droplet.

        In this tutorial, we will show you how to use Let's Encrypt to obtain a free SSL certificate and use it with Nginx on Ubuntu 16.04. We will also show you how to automatically renew your SSL certificate. If you're running a different web server, simply follow your web server's documentation to learn how to use the certificate with your setup.
        • Well no, these are not IP of your droplet.
          As tutorial says it is DNS resolver for upstream requests.
          From nginx site - resolver - Configures name servers used to resolve names of upstream servers into addresses, for example.

 and are IPs of Google Public DNS. You can learn more about Public DNS on their site.

          I recommend you leaving it as it is.
          If you followed this tutorial, it should not be root of your droplet problems.

          • Wow thank you so much! will definitely try these out as suggested now. Will keep you posted :)

          • Hi xMurdll,

            I have followed your guide with a bit of changes for the home directory. It works!

            Very glad you came along and posted. I thought that Phpmyadmin was not compatible yet with Php7.

            All the best!

Have another answer? Share your knowledge.