Windows – How to kill the Apache service on a Windows server

apache-2.2windows

I'm working on an apache module and at some point Apache refuses to start | restart | stop. All I can see in "services.msc" is:

Apache2.2 | Apache/2.2.21 (Win32) | Starting | Automatic | Local System

This is a fresh install and I can't figure out how to force termination. I've rebooted the Windows machine many times (it is a virtual instance), however no luck in figuring out how to stop rebooting.

I've tried:

httpd -k stop|shutdown, but I get:

The Apache2.2 service is stopping.

Failed to stop the Apache2.2 service.

I also have IIS turned off.

Best Answer

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.