Windows 无法在本地计算机上启动 Apache2 - 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/195641/
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 05:32:50  来源:igfitidea点击:

Windows could not start the Apache2 on Local Computer - problem

windowswindows-xpapache2

提问by vaske

During the installation of Apache2 I got the following message into cmd window:

在安装 Apache2 期间,我在 cmd 窗口中收到以下消息:

Installing the Apache2.2 service The Apache2.2 service is successfully installed. Testing httpd.conf....

Errors reported here must be corrected before the service can be started. httpd.exe: Could not reliably determine the server's fully qualified domain name , using 192.168.1.3 for ServerName (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Note the errors or messages above, and press the key to exit. 24...

安装Apache2.2服务 Apache2.2服务安装成功。测试 httpd.conf....

必须更正此处报告的错误,然后才能启动服务。httpd.exe:无法可靠地确定服务器的完全限定域名,使用 192.168.1.3 作为 ServerName (OS 10048) 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。: make_sock: 无法绑定到地址 0.0.0.0:80 没有可用的侦听套接字,正在关闭 无法打开日志 注意上面的错误或消息,然后按 键退出。24...

and after installing everything look fine, but it isn't. If I try to start service I got the following message:

安装后一切看起来都很好,但事实并非如此。如果我尝试启动服务,我会收到以下消息:

Windows could not start the Apache2 on Local Computer. For more information, review the System Event Log. If this is a non-Micorsoft service, contact the service vendor, and refer to service-specific error code 1.

Windows 无法在本地计算机上启动 Apache2。有关详细信息,请查看系统事件日志。如果这是非 Micorsoft 服务,请联系服务供应商,并参考特定于服务的错误代码 1。

Apach2 version is 2.2.9

Apache2 版本是 2.2.9

Does anyone have the same problem, or could help me.

有没有人有同样的问题,或者可以帮助我。

回答by Vinko Vrsalovic

There is some other program listening on port 80, usual suspects are

还有一些其他程序在侦听端口 80,通常的嫌疑人是

  1. Skype (Listens on port 80)
  2. NOD32 (Add Apache to the IMON exceptions' list for it to allow apache to bind)
  3. Some other antivirus (Same as above)
  1. Skype(侦听端口 80)
  2. NOD32(将 Apache 添加到 IMON 例外列表以允许 apache 绑定)
  3. 其他一些杀毒软件(同上)

Way to correct it is either shutting down the program that's using the port 80 or configure it to use a different port or configure Apache to listen on a different port with the Listen directive in httpd.conf. In the case of antivirus configure the antivirus to allow Apache to bind on the port you have chosen.

纠正它的方法是关闭使用端口 80 的程序或将其配置为使用不同的端口,或者使用 httpd.conf 中的 Listen 指令将 Apache 配置为侦听不同的端口。如果是防病毒软件,请配置防病毒软件以允许 Apache 绑定到您选择的端口。

Way to diagnose which app, if any, has bound to port 80 is run the netstat with those options, look for :80 next to the local IP address (second column) and find the PID (last column). Then, on the task manager you can find which process has the PID you got in the previous step. (You might need to add the PID column on the task manager)

诊断哪个应用程序(如果有)绑定到端口 80 的方法是使用这些选项运行 netstat,查找本地 IP 地址(第二列)旁边的 :80 并找到 PID(最后一列)。然后,在任务管理器上,您可以找到哪个进程具有您在上一步中获得的 PID。(您可能需要在任务管理器上添加 PID 列)

C:\Users\vinko>netstat -ao -p tcp

C:\Users\vinko>netstat -ao -p tcp

Conexiones activas

  Proto  Dirección local          Dirección remota        Estado           PID
  TCP    127.0.0.1:1110         127.0.0.1:51373        TIME_WAIT       0
  TCP    127.0.0.1:1110         127.0.0.1:51379        TIME_WAIT       0
  TCP    127.0.0.1:1110         127.0.0.1:51381        ESTABLISHED     388
  TCP    127.0.0.1:1110         127.0.0.1:51382        TIME_WAIT       0
  TCP    127.0.0.1:1110         127.0.0.1:51479        TIME_WAIT       0
  TCP    127.0.0.1:1110         127.0.0.1:51481        TIME_WAIT       0
  TCP    127.0.0.1:1110         127.0.0.1:51483        TIME_WAIT       0
  TCP    127.0.0.1:1110         127.0.0.1:51485        ESTABLISHED     388
  TCP    127.0.0.1:1110         127.0.0.1:51487        TIME_WAIT       0
  TCP    127.0.0.1:1110         127.0.0.1:51489        ESTABLISHED     388
  TCP    127.0.0.1:51381        127.0.0.1:1110         ESTABLISHED     5168
  TCP    127.0.0.1:51485        127.0.0.1:1110         ESTABLISHED     5168
  TCP    127.0.0.1:51489        127.0.0.1:1110         ESTABLISHED     5168
  TCP    127.0.0.1:59264        127.0.0.1:59265        ESTABLISHED     5168
  TCP    127.0.0.1:59265        127.0.0.1:59264        ESTABLISHED     5168
  TCP    127.0.0.1:59268        127.0.0.1:59269        ESTABLISHED     5168
  TCP    127.0.0.1:59269        127.0.0.1:59268        ESTABLISHED     5168
  TCP    192.168.1.34:51278     192.168.1.33:445       ESTABLISHED     4
  TCP    192.168.1.34:51383     67.199.15.132:80       ESTABLISHED     388
  TCP    192.168.1.34:51486     66.102.9.18:80         ESTABLISHED     388
  TCP    192.168.1.34:51490     74.125.4.20:80         ESTABLISHED     388

If you want to Disable Skype from listening on port 80 and 443, you can follow the link http://www.mydigitallife.info/disable-skype-from-using-opening-and-listening-on-port-80-and-443-on-local-computer/

如果您想禁用 Skype 侦听端口 80 和 443,您可以点击链接http://www.mydigitallife.info/disable-skype-from-using-opening-and-listening-on-port-80-and -443-on-local-computer/

回答by Tim Santeford

I hope this helps others with this error.

我希望这可以帮助其他人解决这个错误。

Run the httpd.exe from the command lineto get an accurate description of the problem.

从命令行运行 httpd.exe以获得问题的准确描述。

I had the same error message and it turned out to be a miss configured ServerRoot path. Even after running setup_xampp.bat the httpd.conf had the wrong path.

我有同样的错误消息,结果是配置的 ServerRoot 路径丢失。即使在运行 setup_xampp.bat 之后,httpd.conf 的路径也是错误的。

My error.log was empty and starting the service does not give an informative error message.

我的 error.log 是空的,启动服务没有提供信息性错误消息。

回答by vaske

the better way to resolve the issue is change the port number in Apache2\conf\httpd.conf . Change the port number as fallows::: Listen 8888 and ServerName machinename:8888 .Restart the Apache server after changing the port number.

解决该问题的更好方法是更改​​ Apache2\conf\httpd.conf 中的端口号。将端口号更改为 fallows::: Listen 8888 和 ServerName machinename:8888 。更改端口号后重新启动 Apache 服务器。

回答by user46795

I had the same problem. I checked netstat, other processes running, firewall and changed httpd.conf, stopped antivirus, But all my efforts were in vain. :(

我有同样的问题。我检查了netstat,其他正在运行的进程,防火墙并更改了httpd.conf,停止了杀毒软件,但我所有的努力都白费了。:(

So finally the solution was to stop the IIS. And it worked :)

所以最后的解决方案是停止 IIS。它奏效了:)

I guess IIS and apache cant work together. If anybody know any work around let us know.

我猜 IIS 和 apache 不能一起工作。如果有人知道任何工作,请告诉我们。

回答by John

Run the httpd.exe from the command line, as Tim mentioned. The path to PostgreSQL changed, nothing else was running on Port 80 and I didn't see anything in the error.logfile.

正如 Tim 提到的,从命令行运行 httpd.exe。PostgreSQL 的路径发生了变化,端口 80 上没有其他任何东西在运行,而且我在error.log文件中没有看到任何内容。

I clone my boot drive/partition once the base is setup so I don't have to spend three days installing and retweaking everything. Turns I had reinstalled my WAPP stack and used very specific names/versions for PostgreSQL. Windows will not return a specific error message unless you run the command from the command line.

一旦基础设置好,我就会克隆我的启动驱动器/分区,这样我就不必花三天时间安装和重新调整所有东西。轮到我重新安装了我的 WAPP 堆栈并为 PostgreSQL 使用了非常具体的名称/版本。除非您从命令行运行该命令,否则 Windows 不会返回特定的错误消息。

回答by Gopinath Guru

Follow this step it will works fine. Go to Control panel-->Programs and features-->click Turn Windows features on and off--> see IIS is Checked Or NotIf checked please unckeck IISand restart the computer.After that Open services see Web Deployement AgentService status if its started please stop.And also see WampAppache and WampSqlIDif its not started please start manually. it will works for me.

按照这个步骤它会正常工作。转到控制面板-->程序和功能--> 单击打开和关闭 Windows 功能--> 查看是否检查了 IIS如果选中,请取消选中IIS并重新启动计算机。之后打开服务查看Web 部署代理服务状态,如果它已启动,请停止。如果未启动,请查看WampAppache 和 WampSqlID,请手动启动。它对我有用。

回答by chunguiw

Hi i also meet this problem today. And the log error in the Event viewer is as following The Apache service named reported the following error:

你好,我今天也遇到了这个问题。并且事件查看器中的日志错误如下 The Apache service named 报如下错误:

1.Wrapper php-cgi.exe cannot be accessed: (720005)Access is denied.

2.apache service monitor:the requested operation has failed

1.Wrapper php-cgi.exe 无法访问:(720005)访问被拒绝。

2.apache服务监控:请求的操作失败

It is actual the access problem.So the solution as flowing is help me change the php-cgi.exe security properties

这是实际的访问问题。所以流动的解决方案是帮助我更改 php-cgi.exe 安全属性

  • not inheit from parent the permission...

  • please add the everyone user

  • 不要从父母那里继承许可......

  • 请添加everyone用户

回答by jayaram

if appache and IIS both are running at a time then there is a posibility to hang the apache service,,,,

如果 appache 和 IIS 同时运行,则有可能挂起 apache 服务,,,,

when i stopped all IIS websites once and then restarted apache service and it works for me....Jai...

当我停止所有 IIS 网站一次然后重新启动 apache 服务时,它对我有用....Jai...

回答by Bruno Bertowski Comp Expert

Windows Vista Home Premium operating system issue: The easiest way to resolve the issue is to change the port number in Apache2\conf\httpd.conf.

Windows Vista Home Premium 操作系统问题:解决此问题的最简单方法是更改​​ Apache2\conf\httpd.conf 中的端口号。

Change the port number at the following lines. 'Listen' from 80 to 8888 and 'ServerName' machinename (ex:localhost) from 80 to 8888. Save then close. Open up Apache Service Monitor and restart service or go to Computer Management > Services and locate Apache 2.2 and start or restart.

在以下几行更改端口号。'Listen' 从 80 到 8888 和 'ServerName' machinename (ex:localhost) 从 80 到 8888。保存然后关闭。打开 Apache Service Monitor 并重新启动服务或转到计算机管理 > 服务并找到 Apache 2.2 并启动或重新启动。

回答by vijay

Remove apache from Control Panel and delete the apache folder from Program Files and restart the machine, then install apache again. This will solve the problem; if not do the following: Install IIS if not installed, then start IIS and stop it ... Using services start apache service... enjoy apache.

从控制面板中删除 apache 并从 Program Files 中删除 apache 文件夹并重新启动机器,然后再次安装 apache。这将解决问题;如果没有,请执行以下操作: 如果未安装,请安装 IIS,然后启动 IIS 并停止它...使用服务启动 apache 服务...享受 apache。