46

I accidentally removed my Apache windows service trying to install another Apache web server. Does anyone know how I can create another Apache windows service from cmd? I tried "sc create ..." but I am missing a script on the end like -k start? Not sure what I need for the end of it...

I am running Apache 2.2

Thank you

raven
  • 18,004
  • 16
  • 81
  • 112
Jared
  • 521
  • 1
  • 6
  • 9

6 Answers6

91

On Apache 2.4 the executable have changed name to httpd.exe, the command would be:

httpd.exe -k install -n "Apache2.4"

With a name switch in order to give the service a distinct name.

Alexander Kjäll
  • 4,246
  • 3
  • 33
  • 57
  • I created a .bat file with the following text: httpd.exe -k install -n "Apache2.4" net start Apache2.4 – rmooney Jul 12 '13 at 16:05
11

For older versions of Apache:

Apache.exe -k install
net start apache2
Tomas Andrle
  • 13,132
  • 15
  • 75
  • 92
11

Click Win + R and type cmd

Below Image shows how to install Apache2.2 in windows

How to install Apache2.2 in windows

Default installation location of Apache2.2 is C:\Program Files\Apache Software Foundation but in my pc I installed directly on C:/ drive.

If you want to install Apache2.2 in Program Files folder then in type in command prompt as follows

C:\>cd Program Files ( Click Enter )

C:\>Program Files>cd Apache Software Foundation ( Click Enter )

C:\Program Files\Apache Software Foundation>cd Apache2.2 ( Click Enter )

C:\Program Files\Apache Software Foundation\Apache2.2>cd bin ( Click Enter )

in bin folder you will find httpd.exe file

C:\Program Files\Apache Software Foundation\Apache2.2\bin>httpd.exe -k install( Click Enter)

The successuful message is displayed in command prompt like above shown in the image.

UdayKiran Pulipati
  • 6,579
  • 7
  • 67
  • 92
6

On Apache 2.2, the command is: httpd.exe -k install

trulyte
  • 63
  • 1
  • 4
1

In Windows 7 or 8 right click the XAMPP Control Panel start (menu) shortcut and Run As Administrator. Then just click the service check boxes for Apache and/or MySQL.

pancy1
  • 491
  • 7
  • 16
0

Did not work for me using httpd.exe -k install, I had to register apache as a service using sc.exe using:

sc.exe create apache2.4 start= auto obj= "<account>" password= "<password>" DisplayName= "Apache 2.4" depend= "Tcpip/Afd" binpath= "\"c:\wamp\bin\apache\apache2.4.33\bin\httpd.exe\" -k runservice"
jluu
  • 347
  • 3
  • 7