How to install and setup Apache, MySQL and PHP in Windows

This tutorial will walk you every single step of the way through installing and setting up WAMP (Windows, Apache, MySQL & PHP). With WAMP installed, you can run a web server (and things like WordPress, MediaWiki, and Jinzora) on your Windows PC.

Installing WAMP
Configure WAMP & MySQL
Install and setup Fake Sendmail

Installing WAMP

  1. To get started, head over to the WAMP download page and save the .exe to your desktop. Once the download has completed, run the installation file. The first message you’ll see is a warning – if you have an older version of WAMP (1.x) installed, make sure to uninstall it first. Otherwise click Yes to continue.

  2. click to enlarge

  3. Click Next on the initial setup screen.

  4. click to enlarge

  5. Review the License Agreement, select I accept the agreement and then click the Next button.

  6. click to enlarge

  7. It’s a good idea to leave the default installation directory alone (C:\wamp\) – but if you want to change it, now’s the time. Click Next to continue.

  8. click to enlarge

  9. Decide if you want to have WAMP Quick Launch and/or Desktop icons, and click Next.

  10. click to enlarge

  11. Finally, click Install.

  12. click to enlarge

  13. The installation doesn’t take too long.

  14. click to enlarge

  15. Once it has completed, the setup phrase will begin. If you have Firefox set as your default browser, WAMP will ask you if that’s the browser you want to use. Click Yes.

  16. click to enlarge

  17. At this point, if you have a software Firewall installed, it will probably pop up and warn you that Apache wants to accept incoming connections. Depending on your specific Firewall the “button” to click may be different, but it will be something similar to Unblock. Do not click “Keep Blocking”.

  18. click to enlarge

  19. Leave the SMTP: server set as localhost (more on this later) but do change the email address to yours. Click Next.

  20. click to enlarge

  21. That’s it – you’re done! Make sure that there’s a check in the Launch WampServer 2 now box, and click Finish.

  22. click to enlarge

Configure WAMP & MySQL

  1. In your System Tray you should now see a “WAMP” icon. Click it, and select Put Online (Note: if it says Put Offline ignore this step and skip to the next one).
  2. Open your browser (if it isn’t already) and enter the URL http://localhost.
  3. The WAMP configuration page will load. From here you can access the tools phpMyAdmin, sqlitemanager etc.

  4. click to enlarge

  5. Now you’ll want to set a MySQL password, because by default, WAMP doesn’t set one. Select phpMyAdmin from the WAMP configuration page. At the bottom of the phpMyAdmin screen you’ll see a message about MySQL running without a root password.
  6. To correct this, select the Privileges link. In the User overview section, place a check in the box next to Root – Localhost (see image below) and then click the Edit Privileges button.

    click to enlarge

  7. Scroll down to the Change password section, and enter your password in both boxes. Click Go to save the change.

  8. click to enlarge

  9. Make sure you get a message saying The password for 'root'@'localhost' was changed successfully.
  10. Minimize your browser window, and open up Windows Explorer (or whatever file manager you use in Windows). Navigate to the C:\wamp\apps\phpmyadminx.x.x\ folder. Inside that folder, open up – ideally in an HTML or PHP editor, but Notepad will do if you don’t have an html/php/code editor.

  11. click to enlarge

  12. Search for the line $cfg['blowfish_secret'] = ''; – if you’re using notepad it might be easier to just search for the word blowfish
  13. Change the line $cfg['blowfish_secret'] = ''; to $cfg['blowfish_secret'] = 'mypassphrase'; – where mypassphrase is your own password – not the same one you specified for root in MySQL.

    Note: as you can see from the screenshots above and below, this is much easier to work with in an HTML/PHP editor than it is in Notepad.

  14. click to enlarge

  15. Now search for the phrase ['auth_type'] = 'config'; (again, if you’re using Notepad you might want to just search for auth_type).
  16. Change config to cookie.
  17. Almost done. Now search for $cfg['Servers'][$i]['password'] = ''; Replace the = ''; with = 'your-mysql-password'; – where your-mysql-password is the MySQL password you specified back in step #6 of this section.

  18. click to enlarge

  19. Save the changes you’ve made and exit out of your editor. Click on the WAMP icon in your System Tray and select Restart All Services.
  20. Bring up your browser again, and refresh http://localhost. Select phpmyadmin again.
  21. This time you’ll be prompted to login. Use root as the Username and enter the password you specified in step #6 as the password. Ignore the error about mcrytp not being loaded – we’ll fix that in a minute.
  22. Return to the Privileges section, and this time place a check next to the user root with the host (see screenshot below) and click the Edit Privileges button.

  23. click to enlarge

  24. Set the password to the same one you used for root previously (step #6) and click Go. Confirm the password was updated.
  25. Now select the user root in the host section, and once again click the Edit Privileges button.

  26. click to enlarge

  27. Again set the password to the same one you’ve previously used for root.
  28. And make sure it updates successfully.

  29. click to enlarge

  30. Click the WAMP icon in your System Tray, choose PHP from the menu, then PHP extensions, scroll down to php_mcrypt and select it.
  31. Refresh phpMyAdmin in your browser, and this time you’ll be prompted to login, but without the mcrypt error.

  32. click to enlarge

  33. You’ve now set a password for MySQL, making it considerably more secure.

Install and setup Fake Sendmail

  1. If you’re running Windows XP, 2000 or NT and have an outgoing (SMTP) mail server already installed on your PC, and can be accessed by localhost, you can skip all the steps in this section – your’e done! If you’re using Vista (or don’t have a mail server installed) – keep reading.
  2. Because a number of services you may use require a working mail server, we’ll set up Fake Sendmail and use your ISPs outgoing mail server. An example of a service that requires working mail is WordPress – if you forget your password and want to reset it, WordPress will email it to you. Without Fake Sendmail (or a local SMTP server) every time a service tries to send an email, it will fail.
  3. Head over to and download If your ISP requires that you use SSL, make sure to download as well. Create the folder(s) C:\usr\lib\ and extract (and if you need it) into that folder.

  4. click to enlarge

  5. Open up sendmail.ini in Notepad. Scroll down to the smtp_server= section and change it to smtp_server=your.smtp.server, where your.smtp.server is your ISPs outgoing mail (SMTP) server. If you’re unsure of your outgoing mail server, you can try this list of ISP mail servers – if yours isn’t listed there, check w/ your ISP. In the smtp_port= section, make sure it’s set to 25 – assuming your ISP uses port 25 for SMTP (not all do – though mine does).

  6. click to enlarge

  7. In the default_domain= section, add your ISPs domain. For example, if you use Comcast as your ISP, add Because I have service from Telus, my default domain is (as seen in the screenshot below).

  8. click to enlarge

  9. If your SMTP server requires authentication, add your username to the end of the auth_username= field, and your password to the auth_password= field.

    Note: you can use the Gmail SMTP server (see this FAQ for details) – assuming you have a Gmail account. However, during testing I noticed a considerable delay in receiving mail – up to 7 hours. Using my ISPs mail server settings there was no delay at all.

  10. click to enlarge

  11. Save your changes to the file (sendmail.ini) and exit Notepad. Now click the WAMP icon in your System Tray, select PHP and then click php.ini.
  12. Scroll down to the [ mail function ] section. Comment out each of the For Win 32 lines by adding a semicolon ( ; ) in front of each one (see screenshot below). Uncomment the line sendmail_path = by removing the semicolon ( ; ) in front of it. Add "/usr/lib/sendmail.exe -t" to the end of the line, so that it reads: sendmail_path = "/usr/lib/sendmail.exe -t" (again, see the screenshot below).

  13. click to enlarge

  14. Save php.ini and exit out of Notepad (or whatever editor you used to edit php.ini). Click on the WAMP icon in your System Tray and select Restart All Services.
  15. Now any time one of your web services needs to send an email…
  16. it will go through!
  17. That’s it – you’re done! You now have a fully functional Apache, MySQL and PHP system on your PC.

Home » Email » How to install and setup Apache, MySQL and PHP in Windows

71 thoughts on “How to install and setup Apache, MySQL and PHP in Windows”

  1. Pingback: php - configurazione di phpMyAdmin con WAMP server

  2. Pingback: Setting up mysql database on my windows laptop – Java Learning Blog

  3. hi, I have a problem. I clicked the button ‘ keep blocking’ in the step 9 : ‘windows firewall will block some features of this program’ i.e. apache http server. How can I change this to unblock.

  4. problem: I clicked ‘keep blocking’ in the ‘windows firewall has blocked some features of this program (apache HTTP server)’. How can I change this.

  5. Pingback: start php | blog

  6. Pingback: Fix Easyphp Mysql Error 1045 Windows XP, Vista, 7, 8 [Solved]

  7. Pingback: How to install and setup Apache, MySQL and PHP in Windows « Programming Query

  8. Pingback: Spring MVC – Create your own WebApp Series Introduction | L'Artech

  9. Pingback: How to install WAMP? | Share Your Knowledge

  10. Hi.. i installed wamp.. after installation i tried setting up mysql.. but like u asked to open http://localhost from the wamp tray icon.. i did that n it gives me a http 404 error.. hence im not able to configure the db.. kindly help..

  11. Pingback: Server environments for PHP developers

  12. Pingback: Install WAMP – How to …? | Money making blog

  13. Have not seen an answer yet for missing “blowfish” line in config file.
    Should we be using the config.sample file instead (as that one does have the referred to line item)

    1. Just FYI, I guess its a bit too late but I used the blowfish_secret line as the first like of my config file, just after the $i++ line and things worked. However I wasn’t prompted for the password that I set as the blowfish_secret when logging into phpmyadmin. Not sure why. But since I was only doing a local setup, I wasn’t bothered by it that much. All it asked for was the mysql password.

  14. Hello everybody
    Perfect manual works perfectly in windows me, but my problem is that i have before in my computer MySQL 5 and now I can’t open it after installed WAMP. I don’t know why? Can i use this MySQL Sever with WAMP together in my computer? I know that WAMP have also MySQL, so how to connect the two soft (MySQL Sever and WAMP) because i have some data in MySQL Sever. There are anyone can help me ?

  15. What a nice and easy to follow tutorial thank you thank you very much specially for the “installing fake Sendmail” part

  16. Didn’t work for me. When I clicked the put online option after opening the system tray icon, it gave an error massage that said “could not execute menu item”

  17. I’d follow ds steps,but when i’ved reached the steps in configuring WAMP & MySQL the WAMP configuration page didnt just appeared like this…”IT WORKS!” Pls help me about this.thanks and god blessed.

  18. Pingback: Setting up a local web server – the easy way

  19. The $cfg[‘blowfish_secret’] = ; line can be found in the file which is in the same directory as
    Just take the line from there and paste it into …

    Great tutorial!

  20. Like the 2 previous posts from Fiona and Precious, I too was unable to locate the line $cfg[‘blowfish_secret’]. Following the tutorial exactly as described does not lead one to find that phrase. It is not found under Server Configuration “Tools”.

    Please clarify. Thanks again.

  21. I’ve followed your instructions for installing WAMP, but made an error. Subsequently, I uninstalled and was unable to properly set up php passwords. Is there a way to fully uninstall and start over? I am running Vista on a PC.

    I greatly appreciate your help. thank you.

  22. Helo please help us am also having the same problem just like Fiona the $cfg[‘blowfish_secret’] = ” is not in the config.ini file please kindly update that portion of your tutorial thank you

  23. Hi I have just installed WAMP as per your instructions. But Idid not have the line
    $cfg[‘blowfish_secret’] = ”; in my config file but there was one in my config sample file like others above.
    What do I do now? Are there any updated instructions?

  24. I just installed WampServer 2 and started the manager, but php-win complains that it cannot find “zlib.dll.” Is there anyone that has an answer to this a would be very thankful.

  25. prashanth ram says

    thnks a lot for setting up mysql password. Your steps helped me so much.

    but i have another problem. i downloaded latedt version of wamp. in that c:/wamp/apps/phpmyadmin3.1.3/ file i dint find $cfg[‘blowfish_secret’] = ”; but i changed the config to cookie and set mysql password also. but when i tried to open phpmyadmin .. i am getting error.

    MySQL said:

    #1045 – Access denied for user ‘root’@’localhost’ (using password: No)
    Is there a solution for this yet?

  26. David Willoughby

    my doesn’t have the BLOWFISH text in it. I have a config.sample.php that does. I’m just going to go without a password for now and hope things work, but I’ll check back here to see if I can fix that later.

    If anyone has an answer for me that isn’t in Spanish, I’d appreciate it.

  27. Good afternoon, perfect manual works perfectly in windows me, now my question is, someone can help me do this in ubuntu 10.04?? mind that most interests me is the part of sendmail.ini, because in ubuntu there is no sendmail.ini

  28. Nice tutorial. Seems to have all worked fine. I have two config files though-config-sample and Part of the text I need to change was in config-sample. I changed it. I didn’t dare copy that whole “sample” into Wouldn’t know where to put it. When I logged on I was prompted for login info. That was last night. This morning, it didn’t prompt me for that at all. Checked everything and all seems to be the same as it was last night…..hmmm

  29. Its really a very good tutorial, but when I tried to configure to send mail, i am unable to send mail. I tried to send mail through gmail. Please help me.

  30. Dear sir,

    I am thankful to you for given information.It was very useful for me.Somewhere I found problem bcoz of version difference but overall its good.

    Thanx again.


  31. Pingback: EasyPHP – Apache, MySQL y PHP para Windows

  32. Salve io ho un poblema, quando vado nella pagina localhost la vedo completamente bianca, a cosa può essere dovuto? Uso vista e firefox.

  33. Same problem with and line about the blowfish_secret. Same error message appears a prev reported. Any suggestions please as want to crack on and not sure if I will have follow up problems. Thanks

  34. thnks a lot for setting up mysql password. Your steps helped me so much.

    but i have another problem. i downloaded latedt version of wamp. in that c:/wamp/apps/phpmyadmin3.1.3/ file i dint find $cfg[‘blowfish_secret’] = ”; but i changed the config to cookie and set mysql password also. but when i tried to open phpmyadmin .. i am getting error.

    MySQL said:

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

    can u provide help for this problem
    waiting for u r reply
    prashanth ram
    email:[email protected]
    Hyderabad, INDIA

  35. hola que tal segui paso a paso el tutorial tengo dudas en la parte de la configuracion del wamp cuando entro a phpmyadmin me sale esto.

    El archivo de configuración ahora necesita salvoconducto (una frase secreta) (blowfish_secret).
    Su versión de librería PHP MySQL 5.0.51a es distinta de aquella de su versión de servidor MySQL 5.1.32. Esto puede ocasionar un comportamiento impredecible.

    cuando estaba modificando la parte del config.ini.php no me sale la parte donde dice lo del blowfish_secret por lo tanto no lo puse.

    es la version del mysql el que me esta dando problema donde consigo la que tiene la parte donde pide ese pass del blowfish

  36. Hi, thanks a lot for the article.
    I have a problem: my file is almost empty, there is only a row and $ cfg [ ‘blowfish_secret’] is not inside
    Can you help me, please?
    Thanks again.

  37. Salve, le scrivo per farle una domanda: ho installato WAMP2.0 su WinXP e poi ho iniziato la configurazione da lei spiegata così bene, al momento però in cui apro il file con Blocconote ottengo una videata vuota (ad eccezione della sola prima riga), al suo interno ho cercato $cfg[ ‘blowfish_secret’] ma senza trovare niente, sembrerebbe vuoto il cile di configurazione di PHP.
    Le chiedo gentilmente di aiutarmi a risolvere questo problema.

    Hi, i have a problem on MySQL-PHP configuration: after having inserted password using PHPMyAdmin into user table of myqsl database, I opened the file using Blocconote but the window of blocconote was almost empty, there was only a row but there wasn’t $ cfg [ ‘blowfish_secret’]. How can I solve this problem?
    Can you help me?
    Thanks alot.


  38. I download the latest WAMP software, installed but when in phpMyAdmin,
    I only have on root user with localhost. Also did not have the line
    $cfg[‘blowfish_secret’] = ”; in my config file. I ended up manual adding the line.
    Is that correct? What should I do about the other uses?

  39. Thanks for the info RE Fake Sendmail.

    It didn’t work for me, however, until further googling revealed that WampServer puts a second php.ini file in c:\wamp\bin\apache\Apache2.*\bin, and that’s the one I had to make the relevant changes to. Making the changes to c:\wamp\bin\php\php5*\php.ini didn’t work.

    Just in case someone else hits the same wall …

    — stan

  40. Thank You BUT!!!

    Excellent :0

    but I still get the error:-
    Cannot load mcrypt extension. Please check your PHP configuration.

    Otherwise with a very small sql database it works OK :)

    I think I need to make some changes to allow much bigger sql databases (2Gb would be nice)

  41. Pingback: How to install applications on your N95 from a local web server - Simple Help

  42. Hi, I followed your instructions to the letter, been having a heck of a time getting PHP5, Apache2 and MySQL to work together. I am having problems still, only now I just get a barrage of error messages saying various DLL files are missing. I didn’t figure I’d have to change any configurations just to get the program to start initially, but apparently something went wrong somewhere.

  43. Chaos i did try XAMPP and it wouldn’st setup correctly and apache and mysql failed to staer because the installer placed them some where and the program couldnt find them… grew tired of 30 minute install and constant failures to start the apache server… tried again to get the wamp server installed and it started fine… oh another point… just so people know i followed the instructions as they are printed, where you put my passphrase, i found that if it was different than the root pw it would lock me out of the phpmyadmin admin off the local host… however when i used the root password and followed the remainder of the instructions it woulded right…

    anywho i dont feel that the xwampp thing really works however i welcome you all to try it…

    Chuck Jessup

  44. Excellent instructions. After I installed WAMP, I’ve issue setting up MySQL password. Tried many suggestions from many sites and though most offered some basic information, none has been so detailed and easy as on this site. Wish I had found this site three weeks ago when I first installed WAMP.

Leave a Comment

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