How to uninstall Apache with command line
Asked Answered
S

5

25

So I'm trying to find a command to uninstall apache from windows that I have installed earlier with an NSIS script.

Basically apache is part of a package of aplications we use for our program, and when uninstalling our program we uninstall them all. Already working for postgres, java and ruby, but I'm not finding any command for apache.

I tried the wmic command, but it required user to confirm the action. There isn't any httpd uninstall command?

httpd -k uninstall 

simply removes the service.

Thanks

Supererogation answered 26/8, 2013 at 16:11 Comment(0)
M
18
sc delete Apache2.4

Remove service in windows

Mahmud answered 6/11, 2016 at 13:53 Comment(0)
C
7

On Windows 8.1 I had to run cmd.exe as administrator (even though I was logged in as admin). Otherwise I got an error when trying to execute: httpd.exe -k uninstall

Error: C:\Program Files\Apache\bin>(OS 5)Access is denied. : AH00373: Apache2.4: OpenS ervice failed

Cleavable answered 12/12, 2014 at 22:46 Comment(2)
Is this a comment or an answer?Sometime
Looks like an answer to me (and it got several upvotes meanwhile).Ophite
M
1

I've had this sort of problem.....

The solve: cmd / powershell run as ADMINISTRATOR! I always forget.

Notice: In powershell, you need to put .\ for example:

.\httpd -k shutdown .\httpd -k stop .\httpd -k uninstall

Result: Removing the apache2.4 service The Apache2.4 service has been removed successfully.

Moe answered 2/11, 2016 at 11:49 Comment(0)
I
1

Try this :

sc delete Apache2.4

or try this :

C:\Apache24\bin>httpd -k uninstall

hope this will be helpful

Illuminant answered 11/9, 2018 at 15:16 Comment(0)
U
0

If Apache was installed using NSIS installer it should have left an uninstaller. You should search inside Apache installation directory for executable named unistaller.exe or something like that. NSIS uninstallers support /S flag by default for silent uninstall. So you can run something like "C:\Program Files\<Apache installation dir here>\uninstaller.exe" /S

From NSIS documentation:

3.2.1 Common Options

/NCRC disables the CRC check, unless CRCCheck force was used in the script. /S runs the installer or uninstaller silently. See section 4.12 for more information. /D sets the default installation directory ($INSTDIR), overriding InstallDir and InstallDirRegKey. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. Only absolute paths are supported.

Unerring answered 26/8, 2013 at 16:31 Comment(2)
Apache is installed with my installer and it leaves no uninstaller file. It is installer via MSI.Supererogation
I couldn't unintall Apache using this recommandation. May be this is possible only when you use the msi installerStertor

© 2022 - 2024 — McMap. All rights reserved.