Hur man installerar och ställer in Apache, MySQL och PHP i Windows

vid Ross McKillop Augusti 25, 2008

E-post Rengöringsdukdesign & bärare Windows

Denna ska tutorial går dig som varje singel kliver av långt igenom installationen och inställning - upp WAMP (Windows, Apache, MySQL & PHP). Med installerad WAMP, kan du köra en webbserver (och saker gilla WordPress, MediaWiki, och Jinzora) på din Windows PC.

Installation av WAMP
Konfigurera WAMP & MySQL
Installera och ställa in fejkar Sendmail


Installation av WAMP

  1. Att få startat, huvud över till WAMP-nedladdningsida och räddning .exen till ditt skrivbords-. En gång har nedladdningen avslutat, kör installationen sparar. Det första meddelandet som du ska ser är en varning - om du har en äldre version av WAMP (1.x) att installeras, till uninstall ser till den först. Klicka annorlunda Ja att fortsätta.

  2. klicka för att förstora

  3. Klicka Därefter på det initialt ställa in avskärmer.

  4. klicka för att förstora

  5. Granska Licensöverenskommelse, valt Jag accepterar överenskommelsen och klicka därefter Därefter knäppas.

  6. klicka för att förstora

  7. Det är en bra idé att lämna standardinstallationsarkivet ensamt (C:\wamp\) - men, om du önskar att ändra den, nu tiden. Klicka Därefter att fortsätta.

  8. klicka för att förstora

  9. Avgör, om du önskar att ha WAMP Snabb barkass och/eller Skrivbords- symboler, och klickar Därefter.

  10. klicka för att förstora

  11. Klicka, slutligen Installera.

  12. klicka för att förstora

  13. Installationen tar inte för långt.

  14. klicka för att förstora

  15. När det har avslutat, formulerar ställa in ska börjar. Om du har den Firefox uppsättningen som din standardwebbläsare, frågar ska WAMP dig, om det är webbläsaren som du önskar att använda. Klicka Ja.

  16. klicka för att förstora

  17. På detta peka, om du har en programvaruFirewall att installeras, det ska antagligen pop upp och varnar dig det Apache önskar att acceptera inkoms anslutningar. Beroende av din specifika Firewall ”knäppas” för att klicka kan vara olikt, men den ska är något som var liknande till Oblockera. inte klicka ”uppehället som blockerar”.

  18. klicka för att förstora

  19. Lämna SMTP: serveruppsättning som localhost (mer på denna mer sistnämnd) men [[do]] ändra e-posten tilltalar till din. Klicka Därefter.

  20. klicka för att förstora

  21. Det är det - du göras! Se till att det finns en kontroll i Barkass WampServer 2 nu boxas och klicka Fullföljande.

  22. klicka för att förstora


Konfigurera WAMP & MySQL

  1. I ditt systemmagasin bör du nu se ”en WAMP-” symbol. Klicka det och välj Sätt direktanslutet (Notera: om det något att säga Sätt 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.
Related Posts:
  • How to easily install Apache, MySQL and PHP in OS X
  • How to setup Virtual Hosts in Apache
  • How to reset a lost MySQL root password
  • How to install applications on your N95 from a local web server
  • How to install WordPress on your Windows PC
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

    You can always opt out of this email subscription at any time.

    { 1 trackback }

    How to install applications on your N95 from a local web server - Simple Help
    10.28.08 at 7:48 pm

    { 19 comments… read them below or add one }

    1 Abraham 08.31.08 at 8:38 am

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

    2 Nathan J. Brauer 09.02.08 at 10:17 pm

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

    3 chaos 09.05.08 at 11:24 am

    XAMPP is much easier to be honest.

    I’d look into it.

    4 Sanjeev Mishra 09.08.08 at 6:07 am

    Really great help dear!

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

    5 Felix Oquendo 09.11.08 at 4:51 pm

    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.

    6 Chuck Jessup 10.10.08 at 7:27 pm

    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

    7 Garry 10.14.08 at 6:52 am

    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.

    8 Nathan J. Brauer 10.28.08 at 3:13 am

    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.

    9 webripper 11.02.08 at 4:31 am

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

    10 upol 12.12.08 at 9:06 am

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

    11 Thank You BUT!!! 12.13.08 at 11:44 am

    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)

    12 Rohit 01.20.09 at 7:56 am

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

    13 How about poor Perl? 01.20.09 at 2:40 pm

    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”;

    14 Stanley Krute 02.02.09 at 2:22 am

    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

    15 Terry 02.04.09 at 12:29 pm

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

    16 Avinash 02.13.09 at 6:44 am

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

    17 Tommy 02.17.09 at 7:38 am

    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?

    18 Lorenzo 02.22.09 at 6:31 am

    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

    19 Lorenzo 02.22.09 at 6:48 am

    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.

    Leave a Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>