How to install and configure Apache,PHP,MySql and phpMyadmin on windows

Step 1:
Installing apache

Download the best available version of Apache web server for Windows from this Download link

Select

Win32 Binary without crypto (no mod_ssl) (MSI Installer)

or

Win32 Binary including OpenSSL

Here we using Apache HTTP Server (httpd) 2.2.17 Win32 Binary including OpenSSL
Double click the installer->Click next->check i accept the terms in the licence agreement and click next->Next->
Now see the below image to fill the server information



Then Click Next->Next->Next->Install->Finish.
If you are finished , open your favorite browser and type

http://localhost/ 

in the address bar and press enter.
If you will see ‘It works!’ , then your apache works fine.

Step 2:

Installing PHP

Download the latest php version from this Download link
Select VC6 x86 Thread Safe Installer
Here we using php-5.3.3-Win32-VC6-x86
Double click the installer->Click next->check i accept the terms in the licence agreement and click next->Next->
Now see the below image to select the webserver (Apache 2.2.x Module)

Then Click Next->
Select your apache configuration directory.see the below image for the path

The advantage of using the .msi installer is that it will edit and add to the Apache config file for us. In the default Apache 2.2 installation, this will be found at C:\Program Files\Apache Software Foundation\Apache2.2\conf\.

press ok Next-> Next->Install
Click finish to finish the installation.
Restart your apache server,if your are getting any error just restart your pc.

Test PHP installation

To test PHP is installed, Open a simple text editor (like Notepad) and copy/paste below code into it;

<?php phpinfo() ?>

Save as this file phpinfo.php in your Apache Document Root Folder (your home directory)
ie:

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

Now open your favorite browser and type

http://localhost/phpinfo.php

in the address bar and press enter.
If you will see the below page , then your php works fine.

If you are getting below error msg during installation

Click ok and then finish.
Open your httpd.conf file in notepad.the default path is

C:\Program Files\Apache Software Foundation\Apache2.2\conf  

And add the following lines to the end of the httpd.conf file:

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "C:/Program Files/PHP/"
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
AddType application/x-httpd-php .php
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

Save the file and Restart your apache server, if your are getting any error just restart your pc. And Test you PHP installation.

Also Read:  ExplorerPatcher: Customize & Restore Windows UI

Step 3:

Installing MySql

Download the latest MySql version from this Download link
Click MySQL Community Server and select Windows (x86, 32-bit), MSI Installer to download.
Here we using MySQL Community Server 5.1.51
Double click the installer->Click next->next->Install->Next->Next->

Next->Next->Next->Next->Next->Next->Next->Next->Next->Next->

If this is your first MySql Database setup, you simply enter your root password.
Click next->Execute->Finish.

Testing MySQL

Open your MySql command line client
To open MySql command line client Go to Start->All programs-> MySql-> MySql server 5.1-> MySql command line client
Type your password and you will get like this

Step 4:

Installing phpMyadmin

phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of  operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement.

Download the latest phpMyadmin Zip version from this Download link
Here we using phpMyAdmin 3.3.8
Extract the zip archive to this location

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

And rename the phpMyAdmin-3.3.8-all-languages folder to phpmyadmin. Here 3.3.8 is version number.
Now open your apache httpd.conf file and find these lines

<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

Add index.php after the index.html and it looks like this

<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

Restart your apache server.Open your browser and type

http://localhost/phpmyadmin/

in the address bar and press enter.

Type username and password to login.

If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.



This Post Has 65 Comments

  1. CurtisLow

    bubahbb

  2. Rahul

    I have done every step as you told..
    After Installing I got “It works” and PHP info file..
    But when I interact with Mysql with PHP, the page takes a lot time to load then displays a blank page and I can’t even login to phpmyadmin.
    PHP alone works fine but problem is with PHP connecting mysql..

    I have disabled firewall and closed all applications still no answer..
    Please help me here

  3. Roger Ruz

    Thanks for this tutorial it helped me a lot. But I have one problem left. After installing all of the software on my computer, and wordpress, I can’t run the wordpress. It says “Error establishing a database connection”. I don’t know, if what’s causing the problem, I carefully follow your guide but I end up getting this message.

    Please help!

    1. Manikandan

      This means WordPress is unable to establish a database connection.

      reasons

      1.your database login credentials are wrong
      2.your database server is unresponsive
      3.database has been corrupted

  4. Kristian

    Hello. I have installed Apache, MySQL and PHP on Win8. “It works” and phpinfo are both successful but when I try to open “” I get the following error message:

    The website encountered an error while retrieving http://localhost/phpmyadmin/. It may be down for maintenance or configured incorrectly.
    Error code: 500

    Any suggestions?

  5. John

    Great tutorial. However after i follow the directions for the last step and i type in the renamed address I get a 500 error on the browser and the errorlog in apache says
    “[error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico” Im having difficulty figuring out how to fix this. Any ideas?

    1. Manikandan

      Restart and try again.

      1. John

        Thanks I figured it out. i think i must’ve downloaded the wrong phpmyadmin file i redownloaded it and now it works

  6. Roy

    Hey,
    I tried to connect to phpmyadmin. I extracted the folder into the htdocs folder. However, when I type localhost/phpmyadmin I get a list of files in bulletin points (parent directory, changelog, license, readme, etc). I am not able to get the window in which you typr your username and password.

    1. Roy

      lol, sorry. got it!

  7. ALIREZA

    thanks for this tutorial . It helps me a lot 🙂

    1. Manikandan

      Extract the zip archive to this location

      C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

      And rename the phpMyAdmin-x.x.x-all-languages folder to phpmyadmin
      Here x.x.x is version number.

  8. kashif khan

    Hello,
    When I type in the address “http://localhost/phpinfo.php” in the browser I can see the contents i.e …..

    I have understanf that php funstion is not ablt to call?? how can I resolve the issue??

    Thanks and Regards,
    Kashif Khna

  9. Nicolás

    Thank you very much…

    It has the precise steps to install a WAMP.

  10. gong

    thanks, for detail tutorial

  11. RaviKanth

    Thanks for the details provided. Really excellent…………

  12. Prannoy

    thanks for the great tutorial/ Everything is fine but i am not able to login in phpmyadmin through the browser. Can you help me with it?

  13. Bongz

    How do I install these on Windows 7?
    Please help, I followed all instructions here and when I tested Apache it works and when I test PHP it doesnt work. I get the error ”The webpage cannot be found”

    1. Manikandan

      1.check the url
      2.Save as this file phpinfo.php in your Apache Document Root Folder (your home directory)

  14. Alfred D'Souza

    Hello,
    When I type in the address “http://localhost/phpinfo.php” in the browser I can see the contents of the the PHP page that is “” and not the table as you have shown. Any ideas what I would be doing wrong.

    Thanks and Regards,
    Alfred D’Souza

    1. Manikandan

      Open a simple text editor (like Notepad) and copy/paste below code into it;

      Save as this file phpinfo.php in your Apache Document Root Folder (your home directory)

    2. fegyi001

      I think the problem is that you did not restarted Apache before that.

  15. dado

    dude thanks :)) you are great :*

  16. Heartbeat

    Sir,
    Actually every thing will work fine, except windows 7.
    what changes will do to install it in windows 7.
    I had followed your instruction but at-last they says that
    unable to change the data present at httpd.inf.

    so pls give a solution

  17. Kelvin D souza

    Thanks for the post.
    Also I want some details on Mysql and Visual Basic 6.0
    Is it possible to fetch data data from mysql tables and display it or process it in VB

  18. Dave

    everything went great until i had to add index.php to the httpd file. It said accesss denied amd wouldnt let me save it. ( i am the administrator) so i saved the altered httpd file to the desktop, deleted the one in conf and then replaced it with one onthe desktop. Now I cant restart apache at all

    1. Dave

      Had to change my permissions in folder properties. All good now. Great Tutorial

  19. Danman

    Thank you, Thank you, Thank you and Thank you again. If you a lady I would ******* I am so thankful. Been Googling how to properly install PHP like three days non-stop. An geez there are may sites an geeks claiming their way is the best. Out of bout 50 websites an ways of advising how to install PHP…This site is the real thing. “Plain n simple” an simply THE BEST. Thank you again, much appreciated to have someone that keeps it simple straight to the point an NO DEGREE required to get PHP installed. Thanks again n God bless.

  20. T Khong

    Thank you very much. I am looking for this!!!

  21. dhiraj

    thanks…. its really good website.

  22. Dennis

    Thank you very much, this is very helpful.
    This is my first time to configure php, in this site did, It configured in my owned.

    Thanks a lot…

  23. kaiyum

    All installation is completed successfully, THANKS so much 🙂
    BUT .htaccess is not running. What will be the causes…………..

    1. connectwww

      just open notepad save as .htaccess to create .htaccess file

      1. kaiyum

        thanx, but still not working…..
        i mean in my web browser parent directory still open, how to block or make it access denied.
        Do i have to change any code on httpd.conf or php.ini?

  24. Nitramkamunyu

    Hey…
    After installing Apache and testing it; it works!
    After installing php-5.3.13-Win32-VC9-x86
    And creating phpinfo.php in my htdocs
    Not Found

    The requested URL /Program Files (x86)/PHP/php-cgi.exe/phpinfo.php was not found on this server.

    1. connectwww

      1.check the url
      2.Save as this file phpinfo.php in your Apache Document Root Folder (your home directory)
      C:Program FilesApache Software FoundationApache2.2htdocs

  25. Albanziu

    when I type localhost/phpmyadmin its show

    Etc…

  26. safa

    while testing php it show error 404..what do i do??

    1. connectwww

      1.check the url
      2.Save as this file phpinfo.php in your Apache Document Root Folder (your home directory)
      C:Program FilesApache Software FoundationApache2.2htdocs

  27. Ali 24x7

    I have been trying to get these working for the past 4 days continuously, but didn’t get success. 
    THANKS TO THIS EXCELLENT WEBSITE, THAT HELPS ME A LOT AND INSTALL ALL APPLICATION WITHOUT ANY ERROR WITH SIMPLE STEPS. THANKS A LOT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 🙂

  28. m3trella97

    I’m getting this error message from phpmyadmin.

    The mysqli extension is missing.

    any ideas?

    1. admin

      try
      1.restart apache server and then pc
      or try
      2.check php.ini for the mysqli extension entry and Uncomment it (if commented), and restart apache

  29. Piyush

    Excellent Stuff. One line should be added after Apache and PHP installation that if due to any reasons (eg. due to info from other website etc.) if the insllation is not correct then the installed product should be uninstalled and start a fresh using this page.

    Otherwise it is excellent.

  30. Kelly

    I forgot to mention that my only problem is that it’s not letting me log in – when I use my current Intranet host name or the server name, it says I’m not allowed to connect to this MySQL server. If I just use localhost it says access denied (using the correct password which is 12 characters long (numbers/letters/spec chars). Ideas?

  31. firman

    thx for your great website, it’s help’s a lot.

  32. harsh

    wen ever i try to restart apache i get a error message “the requested operation has failed..”..weat is d solution for d same..??

    1. admin

      try to terminate Skype and TeamViewer and iis or anyother on port 80

  33. Shreyas

    I have installed the server, and it also displays “it works”…
    But I try to open the http://localhost/phpinfo.php , it gives 404 Not Found?
    I tried editing the code in the httpd file, but while re-installing the server, it displays Error(S), in line 4**, something…something…

    And I am firm that the errors are due to adding of the addition codes you provided…because it is specifing the SYNTAX ERROR.
    So what should I do next?

  34. Abee

    You are a life saver, I spent 10 hours trying to figure out what you helped me do in a matter of minutes! Thank you so much!!!!!!

  35. floydro

    Great tutorial… Had made a few attempts to install apache+php+mysql on windows 7 and i was about to give up. This was my last attempt and it worked flawlessly.

    Thousand thanks!!!!

  36. cristian

    Yeah! It was iis on port 80,I have simply modified the httpd.conf file and “It works!” 😀 Thanks!

  37. Cristian

    1) installing apache as service (recommended) it gave me an error saying:
    “(OS 10013) attempt to access the socket in a manner not permitted by their access permissions: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    Note the errors or messages above, and press the key to exit.”
    (Google translate :D)
    but the installation has finished anyway.
    2)if I want to install only for the current user,how can I start the service manually?
    3)installing in localhost isn’t a local installation? I mean,if I want to use it in web site,it is fully functional?
    4)can cause problems installing apache in other drives? (I use two partitions,one for windows application and the other for all my stuff,such as my programs)
    P.S. I’m using windows 7 x64 and I recently activated few windows program functions such as IIS…

    …anyway,it’s a good work what you’ve posted!

    1. admin

      terminate Skype and TeamViewer and iis or anyother on that port

  38. Edric

    Thank You So much For this tutorial! This tutorial help me a lot. I think this is the easiest one tutorial that i’ve tried :D. Thanks!

  39. OJ

    Hi,
    Your instructions are very lucid and they helped me a lot.
    Although, I am still having problems with testing my PHP Installation.
    I’ve tried both the solutions you gave, with the second one; it’s unable to load that page and with the first one; it gave me an error saying : Error 404..not found

    Your help is highly appreciated.

    1. admin

      1.Save the phpinfo.php in your Apache Document Root Folder (your home directory) ie: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs
      2.And add the following lines to the end of the httpd.conf file: and restart ur pc ,then test.

      #BEGIN PHP INSTALLER EDITS – REMOVE ONLY ON UNINSTALL
      PHPIniDir “C:/Program Files/PHP/”
      LoadModule php5_module “C:/Program Files/PHP/php5apache2_2.dll”
      AddType application/x-httpd-php .php
      #END PHP INSTALLER EDITS – REMOVE ONLY ON UNINSTALL

  40. ZC

    THANK YOUUUU!!!!!! this tutorial is very informative and helped me out a lot!!!!!!!!!

  41. Sajesh Mohan

    Thank you very much This page helped me a lot to start with PHP

  42. check

    Thanks! I finally understood it thoroughly..

  43. Raja Sekhar

    Thank you very much

    This page helped me a lot to start with PHP

    – Sekhar

  44. Jimmy Wendelken

    It is a wonderful post. I will absolutely be reading this blog more.

Leave a Reply