WAMP and Web Accessible PHPMyAdmin

Occasionally, you want to give a user, or content manager, access to PHPMyAdmin, but you don’t want them to log in to the server itself.  This requires opening up PHPMyAdmin to the web. If you’ve ever purchased shared hosting you know that this kind of thing is done all the time, but still, the security-powers-that-be say it isn’t recommended.  Therefore my disclaimer: don’t try this at home, but if you do, this is how it’s done.

WAMP

WAMP stands for Windows / Apache / MySQL / PHP.  We’re installing Apache, MySQL and PHP in a Windows environment.  In case you haven’t installed the WAMP server yet, you can find everything you need to install WAMP here: http://www.wampserver.com/en/

To make phpMyAdmin accessible to the web really isn’t all that difficult. A lot of the work is already done for you, it’s just a matter of getting the settings right.

1. Login Page

The first thing you need is a login page which PHPMyAdmin already provides. If you’re using PHPMyAdmin directly on the server there is no login page because it’s assumed you already have Admin credentials.  You did just log in to the server, after all.

To make the login page available to the web modify the config.inc.php file found here: C:\wamp\apps\phpmyadmin4.1.14.  In this case we’re use PHPMyAdmin version 4.1.14.  If you’re not using this version, those digits will be different.

In the config.inc file find the following line and confirm that it’s not commented out. This means there should be no // at the beginning of the line.

$cfg['Servers'][$i]['auth_type'] = 'cookie';

Next, find this line and make sure it is commented out.  These lines should be close together, so if you find one the other should be above, or below it.

//$cfg['Servers'][$i]['auth_type'] = 'config';

2. Update the Alias config file

An alias is how Apache recognizes the PHPMyAdmin folder as a web site. You’ll need to update phpmyadmin.conf file which should be located here: c:\wamp\alias\phpmyadmin.conf.

In the phpmyadmin.conf file, find this line:

Require local

and change it to

Require all granted

3. Restart the Apache server

This can be done from WAMP icon in the Notification Area. Left click on the WAMP icon and select “Restart All Services” from the menu.

Now you should be able to open a browser, navigate to the url and alias of your phpmyadmin site and get a login page.  eg http://mysite.com/phpmyadmin.  And that’s all there is to it!

Further reading:

http://www.techrepublic.com/blog/smb-technologist/create-aliases-on-your-wamp-server/

http://stackoverflow.com/questions/2341043/login-page-in-phpmyadmin

Leave a Reply

Your email address will not be published. Required fields are marked *