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.
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.
Step 3 – Stop apache service
With that done the services window will open up. Over there, let’s stop the Apache service for now.
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.
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.
Step 6 – Locate httpd.exe
Over there in the bin directory, you can see the httpd.exe file.
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.
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.
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.
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.
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.