Install and configure phpMyAdmin on IIS

Categories:

Now that you have installed and configured PHP 5 for IIS along with your MYSQL 5 Server, it's time to start doing something useful with it. And where better to start the the enormously useful phpMyAdmin tool written in PHP to manage just about all things MySQL via a web interface. phpMyAdmin is the veritable swiss army knife for all your MySQL administration needs, all conveniently package in a easy to use web interface. Don't just take my word for it, phpMyAdmin just won best Best Tool or Utility for SysAdmins in this years Sourceforge Community Choice Awards. You get the idea then, it is pretty good. In this guide we'll show you how to install and configure phpMyAdmin 3.x in your IIS environment. This guide assumes that you have already installed and configured PHP and MySQL which are required for phpMyAdmin to work. If not, then these guides can be found in the "How To Guides" section of this site.

Installation

First thing to do after you download and extract phpMyAdmin is place the extracted files in the appropriate directory inside your IIS web root so that IIS is able to access it. You may wish to create a separate website for your phpMyAdmin installation, or simply add it as a sub directory or virtual directory under an existing website. Either way you'll need to make sure that the user account used by IIS to access your files has at least NTFS read permissions to all of your files once they are in place.

In this guide we'll place the phpMyAdmin files in a directory called "pma" under the root directory of a website "example.com". Because phpMyAdmin enables you to directly manipulate, and even delete entire databases and users, it is highly recommended that you secure your phpMyAdmin installation using SSL. This can be done by purchasing a certificate from a 3rd party vendor which will cost money, or by creating self signed certificate for IIS yourself at no cost. With all this in mind, then to access the phpMyAdmin installation used in this guide you would type the following into the address bar of your favourite web browser;

https://example.com/pma

Obviously you'd need to alter this URL to reflect your own installation.

PHP Settings

phpMyAdmin uses several PHP extensions to perform its various functions. The extensions you'll need for phpMyAdmin are;

  • MySQL (to connect to the MySQL server on my web hosting)
  • MCrypt (highly recommended for performance when using the cookie authentication method, and actually required for 64-bit environments)
  • MBString (used for multi-byte character support)
  • GD2 (image creation and manipulation library)

To enable these extensions open you php.ini file and navigate to the list of extensions and find these extension names;

;extension=php_gd2.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll

Simply remove the semi-colon (;) from that start, save the file and restart IIS to reload your PHP environment. These extensions should now be loaded into your PHP environment, and can be verified using the phpinfo function as described in the PHP installation guide.

Comments

Yoke.Lee's picture

Config.inc.php missing??

Hi, I've installed latest PHP 5.2.6 on IIS 5.1 server.
Thanks to you I did it well.

No I'm trying to set up the phpmyadmin. But....
I cannot find the congig.inc.php in my php root folder.
I thought I lost it, but then when I saw the original downloaded file from php.net, it's not there either.

Is there anyway to download it somewhere?
I've google it but fruitless...
Thanks.

Brashquido's picture

Your PHPMyAdmin config file

Your PHPMyAdmin config file will be in your PHPMyAdmin root, not your PHP root.

Anonymous's picture

First glitch I found in the tutorial, not bad, but...

I'm a newbie to PHP, MySQL, and phpMyAdmin, and count myself fortunate to have found your tutorials. I've got PHP and MySql installed and apparently working on an old XPpro box. More for a learning environment than development. So my first glitch seems so simple that I'm a little embarrassed to say it, but this is it:
I created user_data as instructed as such -

C:\phpMyAdmin\user_data

Then the instructions say to right click > properties > security, then > add. On my box, however, there is no security tab. Only

General|Sharing|Web Sharing|Customize

So I thought you were talking about the IIS console, but of course there is no access to that directory from there. So, I'm stumped and I can't get to where and what you are describing. Please explain where my problem is. I'll continue on and see if I can complete the installation, but I naturally want to set this parameter. Thanks in advance.

Bob

Brashquido's picture

Not glitch, just WinXP

To start off with make sure you are logged in using an administrative account, just to rule out any permission issue. I wrote the guide based on Windows 2003, however it should work on Win XP as well. I think you'll find that by default Win XP gives you a dumbed done interface. I think disabling simple file sharing should do it, but if not it is going to be a similar option aimed at simplifying the administrative tasks for general users. I always turn these things off straight away as I find they complicate things more than anything. Once I get decent access to the Internet again I'll put a note in the guide for XP users. Thanks for picking up on it!
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Cannot load mcrypt extension. Please check your PHP configuratio

I receive this error message when I try to login:

"Cannot load mcrypt extension. Please check your PHP configuration"

I have confirmed:

a) the right php.ini file is used
b) that php_mcrypt.dll exists in the C:\Program Files\php\ext directory
c) that in php.ini, extension_dir ="C:\Program Files\PHP\ext"

when i load the phpinfo.php file, mcrypt.dll does not exist anywhere in the output

Also, a sepearate issue: what on earth is considered to be the root login if the server in question is Windows 2003? Would that mean the local administrator of the windows box? Would that mean the root account in the Mysql database? Would that mean some root account that is unique to the phpmysqladmin installation? I have tried the local windows admin account AND the mysql admin account and it fails to log me into phpmysqladmin. One thing that may be the reason: the above problem with mcrypt.php. Does authentical fail if that module can't load?

Brashquido's picture

libmcrypt.dll not in path

Sorry for the delayed reply, I've been in an Internet black hole for over a week. The error you've encountered can be caused by several things, but with the mcrypt extension it is usually because libmcrypt.dll (which is used by php_mcrypt.dll) is not accessible to the system.

Please make sure that libmcrypt.dll is present in your PHP folder and that your PHP folder exists in your PATH environment variable.

The MySQL root user is totally separate from any Windows user accounts. This account is created during the MySQL installation and should be accesable using the password you specified (also during installation).

----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Great ^^

I didn't know how to star to do it... and installing php-5.2.6-win32-installer.msi and taking your guide like a reference i have done. It's working ^^

Thks a lot

Anonymous's picture

You make my day! Thanks a

You make my day! Thanks a whole lot!

Anonymous's picture

cannot login

Hi,

thanks for this useful guide to install pma.

I have a problem logging into the login page, but get no error. I use the root with its password.

Next the page appears again with a token in the url...

any hints of what could be going wrong?

thanks a mucho,
crimson

Brashquido's picture

Check your sessions directory

Hi Crimson,

I'd suggest ensuring that your PHP sessions directory is writable by IIS. If pma can't create the session in PHP, it will cause login issues.

----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster