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

by Ross McKillop on August 25, 2008

Email Web Design & Dev 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 config.inc.php – 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 127.0.0.1 (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 production.mysql.com 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 http://glob.com.au/sendmail/ and download sendmail.zip. If your ISP requires that you use SSL, make sure to download sendmail-SSL.zip as well. Create the folder(s) C:\usr\lib\ and extract sendmail.zip (and sendmail-SSL.zip 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 comcast.net. Because I have service from Telus, my default domain is telus.net (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.
  • Abraham

    This indeed made a great contribution for me as a novice user of the wamp server. Thank you very much

  • http://www.nathanbrauer.com Nathan J. Brauer

    Thank you very much! Out of all the tutorials I found out there, this was by far the best AND easiest! Kudos and Thanks!

  • chaos

    XAMPP is much easier to be honest.

    I’d look into it.

  • http://sansign.info Sanjeev Mishra

    Really great help dear!

    Thanks a lot…!!!!!!!!

  • Felix Oquendo

    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.

  • http://www.destructionreborn.com/www.sierra-tech.com/icwa/index1.html Chuck Jessup

    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

  • Garry

    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.

  • http://www.NathanBrauer.com Nathan J. Brauer

    I tried Xamp. Way too many things to take care of for a starter and it isn’t nearly as self-installing as this one.

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

  • http://frickit.co.cc webripper

    Thank you very much! thats the best tutorial i ever seen

  • upol

    the link http://glob.com.au/sendmail link is down. Any other work around?

  • http://www.acomputerportal.com/mysql.html Thank You BUT!!!

    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)

  • Rohit

    The BEST tutorial…I recommend this for an Award if there is any out there!! :-)

  • http://www.acomputerportal.com/perl.html How about poor Perl?

    How about poor Perl? I found this did not display properly I’ve tried ever shebang in the book. It worked but showed the word>>>print<< instead if displaying what was in the print “hello world\n”;

  • http://stanleydaily.com Stanley Krute

    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

  • Terry

    Could not see production.mysql.com host. Is there something that I did wrong?

  • Avinash

    Indeed this tutorial helped me very much…thanx a lot….

  • Tommy

    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?

  • Lorenzo

    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 config.inc.php 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 config.inc.php 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.
    bye.

    Lorenzo

  • Lorenzo

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

  • Brandon

    so wait…. where do you find your ip to make this public?

  • santiago

    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

  • prashanth ram

    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/congig.inc.php 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:jobskhoj@rediffmail.com
    Hyderabad, INDIA

  • http://www.allezfrance.info Paul Napier

    Same problem with config.inc.php 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

  • eleclipse

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

  • Pingback: EasyPHP – Apache, MySQL y PHP para Windows

  • Deepak Pore

    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.

    Regards,
    Makenation.com

  • ./razor

    This howto ROX! Thanx dude!

  • Mukesh

    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.

  • Cate

    Nice tutorial. Seems to have all worked fine. I have two config files though-config-sample and config.inc. Part of the text I need to change was in config-sample. I changed it. I didn’t dare copy that whole “sample” into config.inc. 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

  • freeman7162
  • Gabriel Pic.

    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

  • Squid

    Also, the extensions between php_mbstring and php_ming are non-existent too.

  • David Willoughby

    my config.inc.php 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.

  • anup

    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/congig.inc.php 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?

  • Harpal

    Thanks a lot ..
    Its really very helpful, :) )

  • Anna

    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.

  • dino masoodee

    thanx man~~~~~~~~~~~~~~~~

  • Jordan

    Forbidden

    You don’t have permission to access /phpmyadmin/ on this server.
    This happens to me.
    How can I fix it?

  • Fiona

    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?

  • http://free-animation-software.com Precious

    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

  • Vic Winters

    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.

  • Vic Winters

    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.

  • Patrick

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

    Great tutorial!

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

  • aiyen

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

  • Dave

    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”

  • pouya

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

  • Sylla

    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 ?

  • Claudia

    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)

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

  • Kate

    Jordan, I am having the same problem. Did you ever find a solution? If so, what is it? Thanks!

  • Pingback: Server environments for PHP developers

  • Anitha

    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..

  • Pingback: How to install WAMP? | Share Your Knowledge

  • lenas

    how about installing xampp is there a detailed tutorial as this one…

  • Abhinav

    Keep up the good work brother.Very comprehensive.Thankyou.
    .\m/

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

  • http://www.facebook.com/profile.php?id=769770606 Zeena Alobaidi

    I got up to stage 9 and I can’t find the blowfish text… Help!

  • http://www.facebook.com/jeremytilden Jeremy Tilden

    Just enter it in manually: $cfg['blowfish_secret'] = “passphrase”;

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

  • Ryan Sukale

    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.

  • Sab

    Is this setting same for latest wampserver 5.4??

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