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).
Check Your Visual C++ Redistributable for Visual Studio 2015-2019
Extract Apache and Copy into place.
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.
Click and drag the Apache24 folder onto C: then release the mouse to move the folder into place.
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.
Type the following into command prompt then hit the enter key.
Now type in the following
Nothing apparent will happen, however the Apache Server is now running.
Next open your favourite browser and direct it to localhost
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
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.
Find the Apache2.4 service, then right-click on it and choose ‘start’ from the menu.
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.