Your Localhost is very nearly complete, we've installed Apache, PHP 5 and MySQL 5. I breifly talked about the ability to modify and change MySQL databases. Well phpMyAdmin can do just that, this tool allows you to do this, it helps you manage your MySQL database in a nicely presented admin panel which you can easily change tables, prefixes and much more. This tool is a must if you plan on creating databases on your localhost
Before we begin make sure you have read part one, two and three of the Creating a localhost in Windows series.
Step 1: Downloading phpMyAdmin
First off all your going to need to the phpMyAdmin files you can get them from the official PHPMyAdmin website but to save you time, here's the direct link to a download mirror:
Click to download PHPMyAdmin
Once you have downloaded the files make a new folder called phpMyAdmin in your DocumentRoot. Remember your DocumentRoot is where Apache will look for files on your localhost. We specified this in part one mine was C:/localhost/public_html, what ever your is create a folder called phpMyadmin within in it and extract all the files to that folder.
You should now have a folder sitting within your public_html called phpMyAdmin looking like this:
Step 2: Config.inc.php file
Now that you've placed phpMyAdmin on your localhost you will now need to open it up and find a file called config.sample.inc.php this has all the configuration code needed so you can simply copy it and rename it or simply rename the sample file, I'd copy it so you have a basic template incase everything goes wrong! Rename to Config.inc.php.
There are a few lines in the config but the main ones we need to focus on are:
$cfg['blowfish_secret'] = ''; /* Secret word or phrase for authorization with cookies. This is not your password */ $cfg['Servers'][$i]['host'] = 'localhost'; /* Host is localhost */ $cfg['Servers'][$i]['controluser'] = 'root'; /* Main MySQL Database user is root*/ $cfg['Servers'][$i]['controlpass'] = 'mypass'; /* Password to MySQL */
Blowfist secret: Is simply a keyword or phrase you add in to authenticate sessions, put in anything you like
Host: Where your host is located, and seems we're setting up a localhost, the host is localhost!
Control User: 100% that control user is root
Control Pass: When you set up MySQL during the various setup screens if you inputted a password you must place it in
If you didn't have some of those lines in your config add them in, otherwise just modify the current ones. Now you have nearly set up phpMyAdmin
Step 3: Solving a few errors when you first access phpMyAdmin
When you first access phpMyAdmin (For me it's http://localhost/phpMyAdmin) I was presented with a issue:
And then when I logged in to phpMyAdmin I got a few more:
**Note error 3 blowfish_secret only appears if you didn't add one in on your config.inc.php, just add a word or phrase in to get rid off the error.
To solve the mcrypt error:
A error is occuring with the mcrpy extension as it is not enabled by default, hence why it's giving out the error of can not load. To solve this you will need to edit your PHP config file and go to line 624, you should see this:
;extension=php_mcrypt.dll
Remove the ; and save the config changes. You will then need find the file libmcrypt.dll in your php directory. It is located in the root of your php folder. Copy it over to C:/Windows/System32. You will need to restart Apache for the extension to be loaded (Doing this you may also be logged out of phpMyAdmin and required to login again)
Now the extension is being loaded and the error should of disappeared!
To solve the mbstring error:
There is also an error about a file called mbstring.dll is missing, this is half true, it isn't loaded because it's not in the right place but you do have it. If you open your PHP directory and look the ext folder you should see the file php_mbstring.dll
Open your PHP config, go to line 623 you should see this:
;extension=php_mbstring.dll
Remove the ; and save the configuration. Now open your PHP directory and look in the ext folder for the file php_mbstring.dll copy this over to your C:/Windows/System32 folder. You will then need to restart Apache for the extension to be loaded. Log back into phpMyAdmin and all of your errors should of disappeared.
Congratulations! You have set up phpMyAdmin on your localhost, you can now create, modify and delete any MySQL databases, you now have full control over them! To test out MySQL and phpMyAdmin why not installed a script that requires a database to functions and see how it goes! Well thats it for the Creating a Localhost in Windows series, a total of four parts and over 3000 words of explaination written, I hope it helps you set up your onw localhost! If you have any problems or issues feel free to contact me at the usual address!





James
September 25th
Very strange. Not to sound pompus but did you follow the steps I did on this tutorial, I say that because how I set up it up can differ to people and how they want MySQL to behave if you head over to:
http://www.james-blogs.com/2009/02/15/creating-a-localhost-in-windows-part-3-installing-mysql-5/
And follow my steps when setting up MySQL. Don't forget when uninstalling a service like MySQL a full reboot is most likely required to clear anything.
Let me know if your still having problems.
Thomas Robinson
September 30th
hello James,
im having a slight problem, everything seems to be working fine, i have managed to get the php screen up on my broswer however following your guides 3 and 4 the end product doesn't show, i cannot see the login for phpmyadmin, the browser just hangs saying 'waiting for local host' i have tried restarting the apatche and i have also copied across all the files into the system32 for the errors you have specified however nothing seems to solve this.
any ideas?
thanks
Tomas
James
September 30th
Hi Tom,
Not to worry, im here to help. Glad you get PHP setup, thats half the battle. Can I confirm that MySQL is indeed working? In step 3 there is a basic MySQL connect at the end of the tutorial. Can you tell me if it worked or not. If not then this could be the reason why phpMyAdmin isn't working if the actual MySQL service isn't functioning correctly.
Tshepo
November 24th
I have removed ; from ;extension=php_mcrypt.dll and saved the PHP config file in the PHP Directory and restarted the Apache but i still get this Error: Cannot load mcrypt extension. Please check your PHP configuration.
I have tested my sql in step3 and it is working properly! I really need help what can i do?
James
November 24th
Tshepo when you removed the ; from the extension did you copy the libmcrypt.dll file to your C:/Windows/System32 ?
Tshepo
November 25th
Morning James!
Yes i did copy the libmcrypt.dll file to C:/Windows/System32!
James
November 25th
The problem might be is that phpMyAdmin has been cached by your web browser when the mcrypt error is still appearing. When you view phpMyAdmin on your localhost e.g. http://localhost/phpMyAdmin wait for the page to fully load and then press Ctrl + F5 on your keyboard to clear your cache and see if the error disappears then.
Let me know how that goes
Tshepo
November 25th
Nothing happens the error still appears!
James
November 25th
Have you restarted Apache after adding all of the .dll files and loading the extensions by removing the ;?
Tshepo
November 25th
Yes i have done all of the steps including restarting Apache and i have repeated them 5 times but nothing happens, dont know what to do?
James
November 25th
Can I ask what operating system you are running, which version of Windows.
Tshepo
November 25th
Im running windows 7 Ultimate!
Tshepo
November 25th
Good Day James!
The problem has been solved! i copied the libmcrypt.dll file to C:/Windows not C:/Windows/system32 and everything went just fine.
Thanks
James
November 25th
Glad you got it working. This tutorial series was written long before Windows 7 and even before Windows Vista was seriously being used so I can't say for certain that things will work 100% on any other operating system that is newer than Windows XP.
Dineo
January 5th
Hay James!
I need help on editing a joomla templete will u be able to help me or should you atleast refer me to somebody you know?