Setup Apache On Windows 10

Introduction

Setup Apache On Windows 10 is a guide designed for people installing Apache for the very first time. This guide also forms part of a larger collection aimed at setting up development environments. While there is an all in one installer available, it does not work with the latest version of PHP. Neither do they give any real understanding of the system.

Setup Apache On Windows 10 – Download Apache

The Apache Software Foundation does not provide pre-built binaries for Windows. Consequently, the choice is to compile or download from a third party. They do however provide favourable places to download binaries from. However, only the version from the Apache Lounge is suitable to also run the latest version of PHP (currently 7.4). Visit their page and download the version which matches your system (32 or 64 bit).

Apache Lounge Downloads
Apache Lounge Downloads

Check Your Visual C++ Redistributable for Visual Studio 2015-2019

This needs to be at least version 14.27.29112.0. Download it by using the links here: VC-redist-X64 or VC-redist-x86. If required, install this before continuing.

Extract Apache and Copy into place.

ExtractApache
Extract Apache

It is possible to setup Apache in any location you choose. However, most guides assume it is installed to C:\Apache24. Therefore unless you have a specific reason not to use this location, it is probably a good idea. Do not extract the folder directly to C:\Apache24, rather extract it to your downloads folder first. The folder you need to move to the root of C: is inside the extracted folder.

Extracted Apache folder image
Extracted Apache folder

Click and drag the Apache24 folder onto C: then release the mouse to move the folder into place.

Drag and drop Apache Image
Drag and Drop the folder

Configure Apache 2.4

The next task is to test Apache, then set it up to run as a Windows service. Start by opening a command prompt window as the Administrator. Type ‘cmd’ into the search box next to the start button. Then right-click on the result, followed by run as administrator.

command prompt as administrator - Setup Apache On Windows 10
Command Prompt (CMD) as administrator

Type the following into command prompt then hit the enter key.

cd c:\Apache24\bin

Now type in the following

httpd

Nothing apparent will happen, however the Apache Server is now running.

Apache24 Server running in cmd
Apache 2.4 Server running in command prompt

Next open your favourite browser and direct it to localhost

Apache24 Running
Apache 2.4 Running in a web browser

Setup Apache 2.4 as a Windows Service

Stop Apache running by clicking back into the command prompt window, then using the ‘CTRL+C’ key combination (hold down the ‘Ctrl’ key and press the ‘C’ key before releasing both). It will take a little time, but the Apache Server will stop. When the server stops type in the following line followed by the enter key to add Apache as a Windows service.

httpd.exe -k install
Install Apache as a windows service
Install Apache as a windows service

Starting The Apache Windows Service

Type ‘services’ into the search bar next to the start button then click on the Services application, which comes up.

loading services in windows
loading services in window

Find the Apache2.4 service, then right-click on it and choose ‘start’ from the menu.

Start the apache service - Setup Apache On Windows 10
Start the Apache service

You can now close the command prompt window and the services window. Apache will be running in the background and start up with Windows in the future. Further configuration of Apache will be required to use it with PHP. This is covered in another blog.

Video Demonstration

Related Articles

Related Post

4 thoughts on “Setup Apache On Windows 10

Leave a Reply

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