How do I install and setup phpMyAdmin on a LAMP Droplet with Virtual Hosts

Posted March 12, 2019 2.7k views
UbuntuMySQLApacheDigitalOceanUbuntu 16.04Ubuntu 18.04

Original question here

I am trying to add phpMyAdmin to a droplet I am trying to follow this tutorial the tutorial is written for Ubuntu 16.04 I run 18.04.

I have currently

Besides the above, I have run this in the terminal

  • sudo apt-get update
  • sudo do-release-upgrade
  • apt-get upgrade
  • apt-get dist-upgrade

I am now trying to install phpMyAdmin from this tutorial

The problem occurs when I run:

sudo phpenmod mcrypt 

It gives me this error: Module mcrypt ini file doesn’t exist under /etc/php/7.2/mods-available

If I run sudo phpenmod mbstringnothing happens.

So I can’t get any further with the tutorial

This person have/had the same problem as me and one guy reply to him and said:

“If you installed it in a different way or have multiple VirtualHosts, then we might need to do a little adjusting to get it running.”

The thing is, this tutorial encouraged me to add VirtualHosts so I did that following this tutorial as I also mentioned above, but now I have no idea on how to proceed and install phpMyAdmin on one of the virtual host’s websites

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hey friend!

I may be able to help on this. Instead of phpenmod mcrypt can you try this tutorial instead?

I’ve not tested it, but mcrypt isn’t in the repositories as a PHP module, so this looks like the easiest path.


  • Well, I kinda gave up… I’m used to using web hotels.. I’d like a more robust solution for this project.

    It is, however, outdated tutorials for PHP < 7.2 and Ubuntu 16.04.... and I am using PHP 7.2 and Ubuntu 18.04..

    As a web developer with no knowledge on ubuntu and virtual hosts files have no clue on how to solve… so I think I will end up canceling my digital ocean and move back to a web hotel… yikes.

    I followed the steps step by step if a tutorial said I needed to follow another tutorial before using that tutorial I did that… and the LAMP auto setup wrote:

    ‘Creating an Apache virtual hosts file for each site maintains the default configuration as the fallback, as intended, and makes it easier to manage changes when hosting multiple sites.’

    Well that’s just sad, cause none of the stuff that people told me to do, none of the tutorials … nothing worked.

    • What if we take a step back and ask what the purpose is for needing phpMyAdmin? If you’re just looking to import a database, it can be as easy as this:

      mysql database name < database_backup.sql

      With that said, it’s totally understandable if it isn’t the right environment where you can be most productive. There is absolutely no shame in picking the product that meets you where you are at. We’d love to have you, but we understand that it can take time to get used to managing your own server. Frankly, a lot of people do not have time for that, and they choose managed solutions so that they can delegate it to others.

      There are also providers who provide managed solutions on top of our systems. A popular one that comes to mind is Cloudways.

      • Its easy for someone who knows how to do everything ^^, I really need phpmyadmin, I test a lot of queries and other stuff in there :)

        I’d much rather be here on digital ocean, and get everything done, and a wider knowledge about servers and Linux operating systems like Ubuntu, the problem is just that I have to launch the website in 24days… and parts of the website is not done yet, so 3 days fighting is a long time :)

        I have deleted all the droplets, created a new one fresh with LAMP.. I will try not to do the virtual hosts files part, as that seems to cause the problem.

        I am waiting for the to direct to my droplets IP, how long does this normally take?

        I have 2 A and which directs to my droplets IP and 3 NS’s point to digital ocean n1,n2,n3

        I am concerned with the security and management tho.

        • It should take about 1-4 hours for DNS propagation (misleading but universal terminology for it).

          To be honest you can get by without touching virtual hosts if it’s one website. Just put the website in /var/www/html. It should install phpMyAdmin if you do this:

          apt-get update
          apt-get install phpmyadmin -y

          Then perhaps a restart of Apache:

          systemctl restart apache2

          It installs a config into Apache that takes /phpmyadmin (, IP/phpmyadmin, anything /phpmyadmin) and directs it to the application. Then you would log in with a MySQL user on the system. You can find a guide on creating a MySQL user here:

          by Etel Sverdlov
          MySQL is a powerful database management system used for organizing and retrieving data. This tutorial explains how to to create new MySQL users and how to grant them the appropriate permissions.
          • It is just 1 website, I will probably do it this way and try to make it work.

            And if it does, I will vengefully come back and create another droplet and try to run 2 websites on server/droplet.

            However, I would like to let you know that I am very happy for your help and responses.