I have a remote machine with LAMP and PHPMyAdmin (PMA). Let's assume this distro is Debian/Ubuntu.

If I install PMA via apt install phpmyadmin (which will make it to be installed under /usr/share/phpmyadmin/ I think) then I wouldn't be able to navigate to PMA based on domains of my websites hosted on that lamp (the following will error):


If I remember correctly, I'll have to navigate via say MY_IP_ADDRESS/usr/share/phpmyadmin/ to access PMA successfully.

But if I'll install PMA directly on the document root via the following way I would indeed be able to navigate to PMA based on domains (as shown above):

cd /var/www/html/
rm -rf ${pma}*
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
unzip ${pma}*.zip
mv ${pma}*/ phpmyadmin/
rm ${pma}*.zip
unset pma

On the one hand, installing PMA with apt install phpmyadmin is simple and convenient. On the other hand but doesn't let me navigate to it based on domains. On the other hand, I do want to navigate to it just based on domains.

If I'm not wrong, a symlink can be helpful. Am I in the right direction (I can't test now)?

  • Your premise assumption is mistaken. Unless your distro's package management is utterly insane, it won't install the entirety of PMA into /etc/ - just the config files, at most. Any further explanation will depend on which distro you use and how their package management delivers PMA. – Shadur Dec 19 '18 at 7:47
  • Maybe I confused /etc with some other dir like /bin/ or /usr/, but it should be one of those, AFAIR. – user149572 Dec 19 '18 at 8:05
  • There are fundamental and crucial differences between the nature of /etc/ on one hand and /usr/share or /bin/ on the other. I'll try to write an answer, but you may want to add the debian tag to this question because it's going to be distro-specific... – Shadur Dec 19 '18 at 8:21
  • Question updated per that comment, @Shadur. Thank you, – user149572 Dec 19 '18 at 8:25

In fact, Debian installs the majority of PMA into /usr/share/phpmyadmin which is the LSB standard correct location for it. But that's a detail that's not terribly relevant to the premise of your question.

What Debian's PMA package also does is drop a config file in /etc/apache2/conf-available/phpmyadmin.conf that sets up the specifics PMA needs to run properly. You can look into it on your own time if you want the details, but what it boils down to is that from that point on PMA can and will work with every site you configure that has working PHP available, simply by adding the following line to the <VirtualHost> directive:

Alias /phpmyadmin /usr/share/phpmyadmin

At that point PMA should work for that site without any further actions required.

(Also, drat. Ninja'd.)

  • One clarification since it appears to have caused some confusion: the alias is configured by default, it doesn’t need to be added to each virtual host. (See my answer.) – Stephen Kitt Dec 20 '18 at 11:03

The Debian PHPMyAdmin packages install the main contents under /usr/share/phpmyadmin. That is made available through web server configuration; for example, if you’re using Apache HTTPD, /etc/phpmyadmin/apache.conf is linked to /etc/apache2/conf-available/phpmyadmin.conf, and that can be enabled or disabled using a2enconf or a2disconf. (The preferred, documented method for interactive configuration is dpkg-reconfigure -plow phpmyadmin.)

If your web sites are configured as virtual hosts, you should be able to provide access to /phpmyadmin in all of them by configuring them in a similar fashion; in fact as far as I can tell that should be the default situation, if the PHPMyAdmin configuration is enabled:

Alias /phpmyadmin /usr/share/phpmyadmin

As is often the case, the package’s README.Debian contains useful information and is worth reading (see /usr/share/doc/phpmyadmin/README.Debian.gz on your system).

  • Drat, ninja'd. Have a +1, good sir. – Shadur Dec 19 '18 at 8:29
  • Reciprocated ;-). – Stephen Kitt Dec 19 '18 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy