如何手动创建 Apache Windows 服务

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1613720/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:51:20  来源:igfitidea点击:

How to Manually create an Apache Windows Service

windowsapacheservice

提问by Jared

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...

我不小心删除了我的 Apache Windows 服务,试图安装另一个 Apache Web 服务器。有谁知道如何从 cmd 创建另一个 Apache Windows 服务?我试过“sc create ...”,但最后我缺少一个像-k start这样的脚本?不确定我需要什么来结束它......

I am running Apache 2.2

我正在运行 Apache 2.2

Thank you

谢谢

回答by Alexander Kj?ll

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

在 Apache 2.4 上,可执行文件已更改名称为 httpd.exe,命令为:

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

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

使用名称开关为服务提供不同的名称。

回答by UdayKiran Pulipati

Click Win + Rand type cmd

单击Win + R并键入cmd

Below Image shows how to install Apache2.2in windows

下图显示了如何Apache2.2在 Windows 中安装

How to install Apache2.2 in windows

windows下如何安装Apache2.2

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

Apache2.2 的默认安装位置是,C:\Program Files\Apache Software Foundation但在我的电脑中我直接安装在C:/驱动器上。

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

如果你想在 Program Files 文件夹中安装 Apache2.2 然后在命令提示符中输入如下

C:\>cd Program Files( Click Enter )

C:\>cd Program Files(点击进入)

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

C:\>Program Files>cd Apache Software Foundation(点击进入)

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

C:\Program Files\Apache Software Foundation>cd Apache2.2(点击进入)

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

C:\Program Files\Apache Software Foundation\Apache2.2>cd bin(点击进入)

in bin folder you will find httpd.exefile

在 bin 文件夹中,您会找到httpd.exe文件

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

C:\Program Files\Apache Software Foundation\Apache2.2\bin>httpd.exe -k install(点击进入)

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

成功消息显示在命令提示符中,如上图所示。

回答by Tomas Andrle

For older versions of Apache:

对于旧版本的 Apache:

Apache.exe -k install
net start apache2

回答by trulyte

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

在 Apache 2.2 上,命令是:httpd.exe -k install

回答by pancy1

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.

在 Windows 7 或 8 中,右键单击 XAMPP 控制面板开始(菜单)快捷方式和Run As Administrator. 然后只需单击 Apache 和/或 MySQL 的服务复选框。

回答by jluu

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

使用 httpd.exe -k install 对我不起作用,我必须使用 sc.exe 将 apache 注册为服务:

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"