In this tutorial, we will guide you on how to start apache from command line. In this tutorial, we will teach you how to check whether the apache service is working or not. Furthermore, we will teach you how to work with apache in the command line, how to make changes to the httpd configuration file, etc.
Step 1 – type localhost
Follow this detailed step by step guide in order to learn how to start apache from command line.
First of all, open up the browser and in the address bar, type localhost before you hit the “enter” key. With that done, you will see “it works” being displayed on your screen. This means that the apache services are running.
![Open localhost Open localhost](https://howtech.tv/wp-content/images/002618_img/01.jpg)
Step 2 – Open Services.msc
Now move on to the services window by opening up the run command, typing in services.msc and hitting the enter key.
![Open services through run Open services through run](https://howtech.tv/wp-content/images/002618_img/02.jpg)
Step 3 – Stop apache service
With that done the services window will open up. Over there, let’s stop the Apache service for now.
![Stopping the apache service Stopping the apache service](https://howtech.tv/wp-content/images/002618_img/03.jpg)
Step 4 – Check if apache is running
Now let’s go back to the browser and refresh the page. You will notice that this time, the localhost page doesn’t open up. This means that the apache server has stopped.
![Check whether apache is active Check whether apache is active](https://howtech.tv/wp-content/images/002618_img/04.jpg)
Step 5 – Open command prompt
Now let’s open up the command prompt. With that done, let’s go to the bin directory in the apache folder.
![Go to bin directory Go to bin directory](https://howtech.tv/wp-content/images/002618_img/05.jpg)
Step 6 – Locate httpd.exe
Over there in the bin directory, you can see the httpd.exe file.
![Find httpd.exe in bin Find httpd.exe in bin](https://howtech.tv/wp-content/images/002618_img/06.jpg)
Step 7 – Resume service
If we type httpd and hit the enter key, you will see that the service starts but prompts an error in the process. The error is displayed because the domain name used is not a qualified one. None the less, the service has started.
![Begin service Begin service](https://howtech.tv/wp-content/images/002618_img/07.jpg)
Step 8 – Open config file
Now let’s move to the configuration directory in the apache folder. Over there, let’s open the httpd.conf file in the notepad.
![Open httpd configuration file Open httpd configuration file](https://howtech.tv/wp-content/images/002618_img/08.jpg)
Step 9 – Make changes to config file
Over there, find the “localhost:80” text in the notepad and remove the hash from the beginning of that line. With that done, save the file and close the notepad.
![Change the configuration file Change the configuration file](https://howtech.tv/wp-content/images/002618_img/09.jpg)
Step 10 – Apache will start
Now let’s go back to the command prompt, type httpd once again and hit the enter key.
With that done, you will see that the apache has started in command line without prompting any error.
![Apache will start without errors Apache will start without errors](https://howtech.tv/wp-content/images/002618_img/10.jpg)
Step 11 – Check if apache is working
In the browser, let’s refresh the page again and you will see this web page will open up. This means that you have successfully started the apache server from the command line.
![Check whether apache service is enabled Check whether apache service is enabled](https://howtech.tv/wp-content/images/002618_img/11.jpg)