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

Brashquido's picture

Sessions directory and PHP log

Glad you find the site useful Josh :) . That long token string is your session ID. First thing I'd check is your PHP sessions directory. Your IIS user (iusr_computername) will need at least read and write access to this, and maybe even modify. Also enable and check your PHP log as this often will have useful troubleshooting information. Not sure what the wingding like characters are from, but I'd suggest clearing your browser cache and cookies as well.

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

Anonymous's picture

HTTP 403 Forbidden

I completed each step carefully as you mentioned. I could run http://localhost/phpinfo.php correctly, but I had problem with http://localhost/phpmyadmin -> 403 Forbidden. So I can't login as root. I'm really confused now.

Can you help me figure it out, plz?

Tu9a2's picture

phpMyAdmin - Error

When I try http://localhost/phpmyadmin/index.php, I got an error report: "Cannot load mysql extension. Please check your PHP configuration. - Documentation".
I can still connect to MySQL using command line: mysql -u root -p, then enter my password.

Can you please help me configure phpMyAdmin?

Anonymous's picture

Re: Sessions directory and PHP log

That's the funny thing, the Sessions & Log directories both are set for IUSR to have the following permissions:

  • Modify
  • Read & Execute
  • List Folder Contents
  • Read
  • Write
And when I get in & look a the Sessions directory, it's empty. The same with the php.log file. It's empty, too.

Cleared the cache & cookies, restarted server & my computer. Still the same thing. Is there something else I'm missing with all of this?

-Josh

Brashquido's picture

What was the exact 403 error?

A 403 error will mean there is an IIS and/or permissions issue. Before we can continue however we'll need the exact error number as shown in your browser window. It should be in the format of 403.1 through to 403.20. If using Internet Explorer you'll need to disable friendly error messages in order to see these specific error codes.
----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Brashquido's picture

Check the extension_dir directive in php.ini

First step is to ensure the extension_dir directive in php.ini is set to the correct directory where all your php_*.dll files are. Is MySQL the only extension you are loading?

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

Brashquido's picture

Is the correct php.ini being loaded

On your phpinfo page, have a look at the Loaded Configuration File value towards the very top. Is the value here the correct php.ini file? If so, then while you are there check that the paths set in the session.save_path and error_log directives are set correctly. For error logging you'll also need to ensure log_errors is set to on, and error_reporting is set to something like E_ALL & ~E_NOTICE.

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

Josh_Maxwell's picture

Re: Is the correct php.ini being loaded

Been caught up with other work, so couldn't get back with you on this till now.

phpinfo.php says it's loading C:\PHP\php.ini. That is the correct one, I believe.

sessions.save_path is set to C:\PHP\sessions and error_log is in C:\PHP\log\php.log. I think there has been some progress though. The log file actually has stuff written in it now. I'm trying to install some other programs as well, and it's showing me errors for Piwik, phpmv2 (phpMyVisites), and WordPressMU. I don't believe those are related, though. I'm not getting any errors for phpMyAdmin still.

log_errors is on and error_logging is set to E_ALL in the .ini file, however the phpinfo.php says it's set as "6135". Is that normal?

Not sure if you know much about WordPressMU, but I've found a problem linked between it and phpMyAdmin. Problem: when users create an account, it doesn't send a confirmation/password email. Why? Forum answer: the email isn't set right in phpMyAdmin (?). Have you ever heard of that? Is there an email setting in phpMyAdmin that has to be set?

I'm sure this is outside of this articles function, just thought I'd mention it.

I would think this has to do with MySQL, but I have reset the password as well as added another user with full privileges to access MySQL, so that user account should be able to log-in to phpMyAdmin. At least I'm assuming so...

Again, thanks for all your help,
-Josh

Anonymous's picture

hi, i'm new in php

hi, i'm new in php enviroment, very nice tutorial.
when i run http://localhost/example.com/pma/phpmyadmin i got error HTTP 403.1 Forbidden: Execute Access Forbidden

please help me..

Anonymous's picture

Hi Dominic, i got problem

Hi Dominic,

i got problem here, when i log into localhost/phpmyadmin and i log in username and password, i get error message #2003 - the server is not responding. did i miss something from your step/guide?

by the way can you guide me a little detail step on "creating your phpAdmin Mysql user account"

i'm new in php enviroment

thanks

ewan