Subscribe to the TST RSS Feed

Install PHPMyAdmin on IIS7 and Server 2008

Dave LawlorAfter installing our copy of MySQL on IIS7 and Server 2008, you might be wondering what to do next.

Well if you don’t feel like learning the command line sequences for MySQL you might be interested in using a web based GUI based tool which will make managing the databases a lot easier.

This tool is called PHPMyAdmin and can be found at www.phpmyadmin.net.

What will you be able to do with PHPMyAdmin in the database?

Here is a list of some of the features:

  • browse and drop databases, tables, views, fields and indexes

  • create, copy, drop, rename and alter databases, tables, fields and indexes

  • maintenance server, databases and tables, with proposals on server configuration

  • execute, edit and bookmark any SQL-statement, even batch-queries

  • load text files into tables

  • administer multiple servers

  • create and read dumps of tables

  • search globally in a database or a subset of it

And that is just the short list of features of this very powerful application. It recently was named Best of Open Source Platforms and Middleware by Infoworld.

Note: PHPMyAdmin requires both PHP and MySql to be installed on the server. If you need to please refer back to my articles on installing them:

Download and Install PHPMyAdmin

Ok so now that we know why we should install it, let’s get to the actual installation part.

But before we begin, let’s go download the software at: www.phpmyadmin.net/home_page/downloads.php.

The current version as I write this article is 2.11.9, so I am going to go ahead and download that to get started. Which version you use will depend on your environment; I am going to use the english.zip for this demo. Let’s get started!



1. Extract the files from the archive to a site that is available on the web server (remember the application is web based).

For this demo I am going to use C:\inetpub\wwwroot\phpmyadmin



Install PHPMyAdmin on IIS7 - 1

2. Now start IIS Manager and expand the default website; right click on phpmyadmin and left click on Convert to Application.



Install PHPMyAdmin on IIS7 - 2

3. You can leave the default settings in place for the Add Application window and click OK.



Install PHPMyAdmin on IIS7 - 3

4. Create a folder to save your PHP sessions; for our example I am going to use C:\temp\phpsessions and give full rights to the following users:


IUSR
IIS_IUSRS
Network Service

5. Now go into your php directory and find php.ini — we have to make a few changes:

Find session.save_path and set it to the same as you used in step 4 which in our case is C:\temp\phpsessions and save the file.



Install PHPMyAdmin on IIS7 - 4

6. Please note that this application requires the following extensions for PHP:


MySQL
GD
MBSTRING

If you do not have these on your server already, please install them. If you are using my article to install PHP then in step 6 just add the above extensions to your installation, or if you already installed it rerun the installer msi file and modify your installation to include these extensions.

To check if they are installed do a search for extension=php_mysql in the php.ini and you should see it uncommented.

Do the same for the other extensions:

extension=php_gd2.dll
extension=php_mbstring.dll



Install PHPMyAdmin on IIS7 - 5

7. Go into IIS Manager, go to the default site (that is if you have been following my demo, if you have been modifying your site location or path then use that) and click on Default Document.



Install PHPMyAdmin on IIS7 - 6

8. In the right pane click Add…



Install PHPMyAdmin on IIS7 - 7

9. In the dialog box type index.php and click Ok.



Install PHPMyAdmin on IIS7 - 8

10. Go to the directory that you unzipped PHPMyAdmin to and look for a file named config.sample.inc.php and open it in Wordpad. (You can use notepad but it tends to jumble everything up)

11. Now find the line $cfg[‘blowfish_secret’] = ‘’; you have to fill in this line with anything that you want but it needs to be a value.

Only up to 46 characters and it can be alphanumeric. In this case I am going to use trainsignal1111TST



Install PHPMyAdmin on IIS7 - 9

12. Go down to you see the section User for advanced features and uncomment (Remove the // from the front of the line) the two lines under that and change the pmapass to a different password, for this demo I am going to use trainsignal.



Install PHPMyAdmin on IIS7 - 10

13. next, go down to the next section Advanced phpMyadmin features and uncomment all the lines under it (remove the // from the front of the line).



Install PHPMyAdmin on IIS7 - 11

14. Now save this file as config.inc.php

15. Point your browser to http://localhost/phpmyadmin/ (if you have been following this example; if you have used a different site/directory then point to that) and you should see a login page.

Type in the userid and password for your local MySql server, then click Go.



Install PHPMyAdmin on IIS7 - 12

16. Now you are in and able to manage your MySql instance!

As a quick test let’s create a database by scrolling to the Database link and clicking on it



Install PHPMyAdmin on IIS7 - 15

17. Type in the name of your new database, for this example I am going to use Trainsignaltraining and then click Create.



Install PHPMyAdmin on IIS7 - 16

18. You will now see a page that confirms that database Trainsignaltraining has been created.



Install PHPMyAdmin on IIS7 - 17

That’s all there is to it, now you can quickly and easily manage you MySql databases on IIS7 through PHPMyAdmin.


Related Posts:

29 Responses to “Install PHPMyAdmin on IIS7 and Server 2008”

  • Chris Perry Says:

    I’ve followed this to the letter and have phpMyAdmin working for the most part, but I’m seeing the warning message “Connection for controluser as defined in your configuration failed.” on every page. Any clues as to what I’m looking for to fix it?

  • Chris Perry Says:

    Fixed it. Just had to change ‘controluser’ from “PMA” to “root”

  • David Lawlor Says:

    Chris-

    Sorry I wasn’t able to get back to you on this right away, it was on my list but it seems the list never gets shorter. I am glad you were able to find an answer to your problem, and thanks even more for posting again with your answer.

    Best Regards,
    Dave

  • [...] PHPMyAdmin, for those who haven’t used it before, is a handy PHP app that lets you do database administration via your Web browser.  Handy for getting a database or user created, running ad hoc queries, and so forth.  Learn how to install it by reading this tutorial: Install PHPMyAdmin on IIS7 and Server 2008 [...]

  • jeff Says:

    Hey Dave,

    i get the following warning after i’ve done the setup and launched the main phpmyadmin page:

    Cannot load mcrypt extension. Please check your PHP configuration.

    I can still log into phpmyadmin, but this bothers me. I’ll send another comment with my findings.

    thanks again for the fantastic articles!!

    jeff

  • Kennedy Says:

    Hello!

    I just recently created my first server and i have no idea how to complete step 4. you said “Create a folder to save your PHP sessions; for our example I am going to use C:\temp\phpsessions and give full rights to the following users:

    IUSR
    IIS_IUSRS
    Network Service

    but where? how? once i clicked “ok” to create the phpmyadmin into an application, i dont know what to do.

  • Kennedy Says:

    I found out how to do it. never thank you!

    but right now i am getting an error message #1045 :

    You probably did not create a configuration file. You might want to use setup script to create one.
    Error

    MySQL said: Documentation
    #1045 – Access denied for user ‘root’@'localhost’ (using password: NO)

    what should i do?

  • Tony Montana Says:

    Hi Dave, You are a ruddy star!

    I have been looking for a tut like this for ages but since I am a novice and the other articles are so complex I get lost very quickly and get disheartened. I have followed a few of your articles on setting up IIS7, PHP on IIS, MySql and not only have I been able to follow them but they have worked too! (I installed themk on my Vista machine which I hope to use as my test server but the instructions were exactly the same.)

    I just got one problem that I was wondering if you could help with and it is the same as Jeff’s post on 02.11.08. I get the following error…

    Cannot load mcrypt extension. Please check your PHP configuration.

    and I wonder if this is because when I was loading the extensions, in the PHP install, MBSTRING was not present as an option. (I installed the php-5.2.6-nts-win32-installer.msi – which I think is the one you recommended.)

    I plan to start my web development as an xmas project, as a complete novice, and I cannot thank you enough for getting me started. I didn’t even know there was a decent version of IIS and that it would support PHP.

    I’m gonna use the sitepoint book ‘Build Your Own Database Driven Website Using PHP & MySQL’ to help me but would you be able to recommend a good resource?

    Thanks for all your help so far
    Tony

  • James Says:

    Cannot load mcrypt extension. Please check your PHP configuration.

    Same Error here

  • LPG Says:

    To fix the mcrypt problem, you need to install the mcrypt extension for php. To do this..

    Run the php installer that you originally ran to install php, select “change” when asked what you want to do, and when you get to the page that says “choose items to install” select the extension “mycrypt”.

    I have a different problem I was hoping someone could help me with though. Once I login to phpmyadmin, at the bottom it says “Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.30. This may cause unpredictable behavior.” I can’t find a solution to this, does anyone know please?

    -LPG

  • David Lawlor Says:

    LPG –

    What versions of PHPMyAdmin are you using? I am seeing some bug reports popping up about this but it looks like most of them started on the 9th when the newest versions were released.

    Dave

  • LPG Says:

    I installed phpMyAdmin 3.1.1. Because of your comment though I uninstalled it just now and put 2.11.9 on the system and I’m receiving the same error. Perhaps it’s because I have MySQL 5.1 installed instead of 5.0. So I suppose the latest releases of everything aren’t currently compatible with each other…

    -LPG

  • David Lawlor Says:

    That is actually what I was looking at, I would look for a version of PHP that is around the same date as the MySQL release.

  • LPG Says:

    Installing MySQL 5.0.67 with phpMyAdmin 3.1.1 worked. Thank you for your help and thank you for the article!

  • David Lawlor Says:

    LPG-

    No problem at all! Glad you got it working!

    Dave

  • Chris Says:

    Hello,

    I have installed MySQL as per your document. I have also downloaded the latest PHPMyAdmin version 3.1.1 and installed Everything appears to be configured correctly, however when I try login through the PHPMyadmin website, the login page simply “loops”. I.e. I put in my credentials and without any error returns me back to the blank login page again. If I use legit and non-legit login details it does the same thing. It would appear as if it’s not even trying to Authenticate me.

    Any help on this would be much appreciated.
    THanks
    Chris

  • Mason Says:

    hey friends, i am db user and was recommeneded by my friends to take a look at sqlyog best mysql administrative tool which i found awesome. When i started with this i was new born baby to use and i din find hard to use it. Too friendly take a look and enjoy!!!

  • S.m. Says:

    I love your tutorials about PHP, MYSQL, PHPMYADMIN! im working on my graduation… building a Content Manament System and i needed a testing server at home! Thx and keep up the good work!

  • Lana Says:

    Hey!

    I have been reading and following ALL you tutorials. THANK YOU !
    But i can’t log in. Where did i go wrong?

    #1045 – Access denied for user ‘root’@'localhost’ (using password: YES)

  • Lana Says:

    Sorry, never mind. I was trying to log in with the password which i just wrote in the config file …. after thinking about it, i came to my senses and used the U/P for my MySQL. It works now. Thank you!

  • Thomas Says:

    Thank you for doing the complete tutorials phpmyadmin, FastCGI & PHP, and mysql, I have completed all three and have everything running error dree, finally but I have one final obstacle and i have looked everywhere for the answer but I can’t seen to beat this one.

    Everything is perfect until I try to import sql data to phpmyadmin from another server. I have tried very way I can think of but I still get an error every time i try to import. “File could not be read” That it it just fails and says that and nothing else. I can save and export dump but I cant import at all.

    Please if you have seen this before let me know where I have gone wrong. I have been hung up for days

  • David Potter Says:

    This was extremely helpful. Thanks so much for publishing this.

    I found on another site (http://www.aota.net/PHP_and_MySQL/phpmyadmin.php4) that the advanced features username and password don’t need to be specified unless the authentication type is set to ‘config’. Since the default value for that setting is ‘cookie’ I decided not to set the username and password it worked fine. What do you think? If you can verify this, you may want to remove the steps about setting those settings.

    Thanks,
    David

  • Michal Knoller Says:

    I have already installed mysql and php (after weeks of trying) – now for phpmyadmin I found your explanation very clearand easy to use.
    I got as far as //localhost… and the phpmyadmin doesnt work and now neither does the PHP (which i’ve been using)!!! can you help me??

  • Amster Says:

    Hello there. Again, amazing tutorial thanks. Just one snag – as per Chris Perry’s comment above, I too had the “Connection for controluser as defined in your configuration failed” error once logged into phpMyAdmin, however, after changing controluser to root and controlpass to the same password as that I had defined MySql – the message disappeared.

    Thanks again :)

  • Guillaume Says:

    hello

    Hint:

    For people they got error with phpmyadmin ”File could not be read ” just check
    open_basedir in your php.ini if it set to C:\ (i have use C:\inetpub like this tutorial but got this error and replace open_basedir to c:\ and it solve all my problem :D

    Sorry guy’s for my bad english :P

  • David Lawlor Says:

    The fix from Guillaume would work if your files are not under a directory under the C:\inetpub folder. This demo assumes that you have a setup similar to my install PHP demo where I specified that.

    Thanks Guillaume for helping out!

  • Demi Says:

    Hello!

    I just recently created my first server and i have no idea how to complete step 4. you said “Create a folder to save your PHP sessions; for our example I am going to use C:\temp\phpsessions and give full rights to the following users:

    IUSR
    IIS_IUSRS
    Network Service

    Can someone please explain how to do this. This question was asked earlier but no solution was ever posted. Thanks.

  • Scott Says:

    Do you know if this will work with MySQL Express 2008? Please advise, getting ready to do this install.

    thanks in advance!
    SP

  • TroyC Says:

    I went through all the steps in this fine article and everything was going great until its was time to open http://localhost/phpmyadmin/. I get the following error:

    Warning: require_once(./libraries/common.inc.php) [function.require-once]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\phpmyadmin\index.php on line 34

    Fatal error: require_once() [function.require]: Failed opening required ‘./libraries/common.inc.php’ (include_path=’.;C:\php5\pear’) in C:\Inetpub\wwwroot\phpmyadmin\index.php on line 34

    Will someone please help me? Thank you

Leave A Comment: