Most time ‘phpmyadmin’ doesn’t have to be on the web and it can be a huge security risk if someone obtains an adminstor.of the ‘phpmyadmin’
To simply avoid this, one could control access to phpmyadmin with the following script.
sudo nano /usr/bin/adminphp
[ paste the following script ]
#!/bin/bash currentdir=`echo $PWD` if [ "$1" = "up" ];then cd /etc/apache2/conf.d/ ln -s -T /etc/phpmyadmin/apache.conf phpmyadmin.conf service apache2 reload else if [ "$1" = "down" ];then rm /etc/apache2/conf.d/phpmyadmin.conf service apache2 reload else rm /etc/apache2/conf.d/phpmyadmin.conf service apache2 reload fi fi cd `echo "$currentdir"` exit 0
then make the file excutable
sudo adminphp up
This ables access to phpmyadmin
sudo adminphp down
This disables access to phpmyadmin
This also disables access to phpmyadmin
Basically this script removes the simbolic link of the apache configuration file for phpmyadmin if a server administor wants to disable access to phpmyadmin (gives 404 Not Found error message).
And creates a link to the configuration file if the administor wants to enable access