I'd be suspicious about a service that doesn't properly respond to shutdown/restart requests - you may want to look at re-installing Apache. That said, I'm not an Apache guy, so i'm not sure how common this under Windows7.
All that aside, you should be able to manually kill the httpd.exe process either via Task Manager, or via a command line as such:
TASKKILL /F /IM httpd.exe /T
The command switches specify that you want to kill any process with the image name 'httpd.exe' (/IM httpd.exe), you want to force the kill (/F) and you want to kill any child processes that it spawned (/T).
After doing this, you should be able to manually start the process again via the Services console, or via the 'net start' command.
Answer from Skawt on serverfault.comVideos
function Switch-Webserver {
Param(
[Parameter( ParameterSetName = "IIS")]
[switch]$IIS,
[Parameter( ParameterSetName = "Apache")]
[switch]$Apache
)
switch ($PSCmdlet.ParameterSetName)
{
'IIS' { get-service "Apache" | stop-service -force ; start-service IISAdmin }
'Apache' { get-service IISAdmin | stop-service -force ; start-service "Apache" }
}
}
you can use this function in PowerShell console like this:
Switch-Webserver -IIS # This will stop Apache and start IIS
Switch-Webserver -Apache # This will stop IIS and start Apache
You can put this function inside your PowerShell Profile or load it from a console window like this:
. C:\Path\To\Function\Switch-Webserver.ps1
The trick is to use argument when starting and stopping services so that they can run in the background. First, you may need to install the service. Then. to gracefully stop apache, use this in a script:
httpd -k graceful-stop
Just put the above in a script and execute it and it will stop apache.
To start it, you might've guessed:
httpd -k start
For stopping and starting IIS, you can find there instructions here.
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.
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 /?
Hi Blue
My name is Andre Da Costa; an Independent Consultant, Windows Insider MVP and Windows & Devices for IT MVP. I'm here to help you with your problem.
Click Start
Type: cmd
Right click CMD
Click Run as administrator
Navigate to the default Apache installation directory, for example, C:\Program Files\Apache Group\Apache or wherever apache.exe is located.
You can CD Program Files\Apache Group\Apache
Hit Enter
At the command prompt, type apache -u.
Close the Command Prompt window.
Go to Windows Services and check that Apache is no longer listed as a service.
Press Windows key + R
Type: services.msc
Hit Enter
Uninstall Apache HTTP Server 1.3.26 in Programs and Features
Press Windows key + R
Type: appwiz.cpl
Hit Enter
Scroll through the list.
Delete any Apache installation directories in Windows Explorer, for example, C:\Apache.
Hi Blue
Greetings! I am Vijay, an Independent Advisor. I am here to work with you on this problem.
Windows Key+i > Apps > Apps & features > Click Apache > Uninstall
Do let me know if you require any further help on this. Will be glad to help you.