Manually Installing Apache Server on Windows 7

If you have any previous version of Apache (MSI Installer from apache.org) installed on your system, please uninstall it first from Add/Remove program.

Download Apache Web Server from:

http://www.apachelounge.com/download/ - Windows 32bit
http://www.apachelounge.com/download/win64/ - Windows 64bit

For your reference, My Operating System is Windows 7 Professional 32bit, I use "httpd-2.4.3-win32-ssl_0.9.8.zip" for this installation.

To be able to run Apache 2.2 and 2.4 VC10, Visual Studio C++ 2010 SP1 must be installed on our system. Follow the link below to download it, after you've finished downloading the file double click the file to install it.

Ms Visual C++ 2010 SP1 Redistributable Package (x86) - Windows 32bit
Ms Visual C++ 2010 SP1 Redistributable Package (x64) - Windows 64bit

Updade: Novemeber 2013

If you want to use Apache 2.4 VC11 (Minimum system required: Windows 7 SP1), Visual Studio C++ 2012 must be installed on our system. Follow the link below to download it.

Ms Visual C++ 2012 x86, x64 Redistributable Package Windows 32bit and 64bit.

=== end of update.

If you want to use Apache 2.2 and 2.4 VC9 you can follow the link from here. Apache Server VC9 version

Configuring Apache server


Create a new folder in C Drive name it "Apache" extract the httpd zip file you've downloaded to anywhere on your computer and then copy all files and folders over into "C:\Apache" - Navigate to "C:\Apache\conf" folder, double click "httpd.conf" to open it.

Find the Server Root:

ServerRoot "c:/Apache24"

Change it to:

ServerRoot "c:/Apache"

Next line: Server Admin

ServerAdmin admin@example.com"

Change it to:

ServerAdmin admin@localhost

Next line: Server Name

#ServerName www.example.com:80

Uncomment the line and replace www.example.com with localhost:

ServerName localhost:80

Next line: DocumentRoot and Directory

DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">

Change the lines to:

DocumentRoot "c:/Apache/htdocs"
<Directory "c:/Apache/htdocs">

Next line: cgi-bin Directory

<Directory "c:/Apache24/cgi-bin">

Change it to:

<Directory "c:/Apache/cgi-bin">

Save the configuration file.

Installing Apache


Now, go to the Start Menu > All Programs > Accessories, right-click "Command Prompt" and then click "Run as Administrator"

Navigate to the Apache's bin folder by typing "cd \apache\bin" in the Command shell and then press Enter, type in "httpd -k install" to install the Apache service and then press Enter. If you got any error displayed here, you should fix them first before you try to start the Apache Server. To start the Apache Server simply type in "httpd -k start" and then press Enter.

For more detail see the image below:

Apache Command Prompt

Open your browser and navigate to "http://localhost"

Apache Test Server

Good job!,

Now you can change your Apache Document Root and Directory to make it easier to follow my other tutorials.

Uninstall Apache


In case, if you want to upgrade/downgrade or remove Apache completely from your system follow the steps below.

Open Command Prompt with administrator right (Start Menu > All Programs > Accessories, right-click "Command Prompt" and then click "Run as Administrator") type in "cd \apache\bin" and press Enter, first we will stop the Apache server, type in "httpd -k stop" and then press Enter. Next type in "httpd -k uninstall" to uninstall the Apache Service.

For more detail see the image below:

Apache Command Prompt

That's all, you are safe to delete "C:\Apache" folder or replace it with other versions of Apache.

The next step is installing PHP, use PHP VC9, VC11 thread safe with this Apache server, make sure to use the right binaries, do not mix x86 with x64 binaries.

12 comments:

  1. Nice post.. helped me a lot. Thanks..

    ReplyDelete
  2. Dave ThompsonMarch 29, 2013

    You make it so simple. Excellent, clear instructions. Thanks

    ReplyDelete
  3. thANKS A lot....

    ReplyDelete
  4. Hey, thank you very much, I was so stuck with this insignificant thing... Thanks....

    ReplyDelete
  5. Work like a charm

    ReplyDelete
  6. thanks. Why it is necessary to rename folder Apache24 to Apache?

    ReplyDelete
    Replies
    1. It's not necessary, we rename that just to follow the previous installation.

      Delete
    2. AnonymousMay 12, 2013

      I couldn't open httpd.conf file. which program should I use to open it?

      Delete
    3. You can open that file with Notepad.

      Delete
  7. AnonymousMay 17, 2013

    This worked perfectly as the MSI for Apache 2.2.2 failed to start and had loads of errors

    ReplyDelete
  8. 2.4, Windows 7, installed in a D: drive folder, and everything worked perfectly, first time. Thank you for these excellent instructions.

    ReplyDelete