Going back to absolute basics here. The answers on this page and a little googling have brought me to the following resolution to my issue. Steps to restart the apache service with Xampp installed:-
- Click the start button and type CMD (if on Windows Vista or later and Apache is installed as a service make sure this is an elevated command prompt)
- In the command window that appears type
cd C:\xampp\apache\bin(the default installation path for Xampp) - Then type
httpd -k restart
I hope that this is of use to others just starting out with running a local Apache server.
Answer from Username_null on Stack OverflowGoing back to absolute basics here. The answers on this page and a little googling have brought me to the following resolution to my issue. Steps to restart the apache service with Xampp installed:-
- Click the start button and type CMD (if on Windows Vista or later and Apache is installed as a service make sure this is an elevated command prompt)
- In the command window that appears type
cd C:\xampp\apache\bin(the default installation path for Xampp) - Then type
httpd -k restart
I hope that this is of use to others just starting out with running a local Apache server.
For frequent uses of this command I found it easy to add the location of C:\xampp\apache\bin to the PATH. Use whatever directory you have this installed in.
Then you can run from any directory in command line:
httpd -k restart
The answer above that suggests httpd -k -restart is actually a typo. You can see the commands by running httpd /?
There is a small application Apache installs, usually displayed in the system tray from where you can restart Apache.
You can restart a service with many utilities, like sc.exe, but just using the shell, use
net stop Apache2.2-Zend && net start Apache2.2-Zend
In my case, the name of the service is Apache2.2-Zend. You can check the name in services.msc.
First you must bring the command prompt to the bin of Apache folder on your computer, i.e my Apache folder is in directory C:\Apache24\.
I used command cd C:\Apache24\bin and then used command httpd -k restart to restart the Apache service.
Videos
The restart action causes Apache to reload and apply its configuration, without actually restarting the process or breaking any opened client connection, causing a so called "graceful reload". You can check it by yourself with Windows Task Manager, the Apache PID (Process ID) won't change after a restart.
However, any action triggered by the option -k (they are called signals), needs the Apache service to exist in Windows services list.
Therefore, if you see this error message, there are only two possible causes:
Your Apache service does not exist
Then just create it with
httpd.exe -h install
Now you should be able to send the restart signal
httpd.exe -k restart
Your Apache service has a custom name
If the service exists, but has a custom name such as "My Awesome Apache Service", then you have to specify that name when you want to send it any signal.
So, if you have installed it with
httpd.exe -k install -n "My Awesome Apache Service"
you have to restart it with
httpd.exe -k restart -n "My Awesome Apache Service"
I think the service is not registered in windows registry try
httpd -k install