0

I used the following instructions to install phpMyAdmin into Centos 7 webserver:

wget https://files.phpmyadmin.net/phpMyAdmin/4.6.5.2/phpMyAdmin-4.6.5.2-all-languages.tar.gz
tar xvzf phpMyAdmin-4.6.5.2-all-languages.tar.gz
mv phpMyAdmin-4.6.5.2-all-languages phpmyadmin
mv phpmyadmin /var/www/html/

Oddly (different from what I read in other questions), phpMyAdmin was installed here:
/var/www/html/phpmyadmin
And the phpmyadmin config file is here:
/var/www/html/phpmyadmin/config.inc.php

With the default apache configuration, the website is viewed from /var/www/html and phpMyAdmin is viewed from /var/www/html/phpmyadmin, and looks like this in the URL:

http://www.foo.com/phpmyadmin

So far so good, all working.

However, I added a virtual host and am now serving the website out of /var/www/foo.com/public_html

<VirtualHost *:80>
   ServerAdmin admin@example.com
   DocumentRoot /var/www/foo.com/public_html
   ServerName foo.com
   ServerAlias www.foo.com
   ErrorLog /var/www/foo.com/error.log
</VirtualHost>

It works if I mv /var/www/html/phpmyadmin /var/www/foo.com/public_html, but when logging in via FTP, I don't want the phpmyadmin folder to be visible under the /var/www/foo.com/public_html folder.

Is there a way to leave phpmyadmin in its original location at /var/www/html/phpmyadmin, but still be accessible via the url http://foo.com/phpmyadmin ?

  • Ideally you'd have your phpmyadmin files somewhere else and use an include/alias to bring them in to whatever host you want at whatever URL you want. Don't wanna go all distro war, but check out how Debian sets up apache config and brings in phpmyadmin when installed via apt - much better than what redhat/cent or net/freebsd – ivanivan Mar 9 '18 at 2:00
1

Just create symbolic link to your original phpmyadmin folder in /var/www/html => ln -s {path of phpmyadmin} /var/www/html/phpmyadmin folder and configure httpd to Allow symbolic links with FollowSymLinks option

1

You can actually put the folder anywhere as long as there is r-x permissions(not sure about write permissions).

For Apache v1:

Edit /etc/httpd/conf-available/phpmyadmin.conf or wherever the httpd folder is
Add the line Alias /phpmyadmin /location-of-folder if it is not already there
Run systemctl restart httpd

For Apache v2:

Edit /etc/apache2/conf-available/phpmyadmin.conf or wherever the apache2 folder is
Add the line Alias /phpmyadmin /location-of-folder if it is not already there
Run systemctl restart apache2

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.