简体   繁体   English

安装成功但无法在我的 Windows 7 系统上启动 apache 2.4

[英]Succeeded installing but could not start apache 2.4 on my windows 7 system

I am attempting to install and run apache 2.4 on my windows 7 system I went to the apache 2.4 bin directory and ran the following: Note: I opened the cmd window as administrator.我试图在我的 Windows 7 系统上安装和运行 apache 2.4 我转到 apache 2.4 bin 目录并运行以下命令: 注意:我以管理员身份打开了 cmd 窗口。 C:\\Apache24\\bin>httpd.exe -k install C:\\Apache24\\bin>httpd.exe -k 安装

Its output was as follows:它的输出如下:

Installing the Apache2.4 service
The Apache2.4 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions.  : AH00072: make_sock: could not bind to address [::]:80
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions.  : AH00072: make_sock: could not bind to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open log

So it installed apache 2.4 as a service but it could not be started.所以它安装了 apache 2.4 作为服务,但它无法启动。 It seems like the localhost port 80 is being used.似乎正在使用本地主机端口 80。 Is this what "[::]:80" means?这是“[::]:80”的意思吗?

I then stopped both the the apache 2.0 service which I had left running and the mysql service, hoping stopping one of them might free up localhost port 80.然后我停止了我一直运行的 apache 2.0 服务和 mysql 服务,希望停止其中之一可以释放本地主机端口 80。

I also run netstat -o to see if port 80 is being used.我还运行 netstat -o 以查看是否正在使用端口 80。 It was not.不是。

But, I then found that a process was using the above socket it is a process that is listening on the above socket但是,然后我发现一个进程正在使用上面的套接字它是一个正在侦听上面的套接字的进程

 TCP    [::]:80                User-PC:0              LISTENING       4

I then ran tasklist and found out that System is using pid 4. 4 is under the pid column然后我运行 tasklist 并发现系统正在使用 pid 4. 4 在 pid 列下

System                           4 Services                   0        544 K

Finally, from the failed attempt to start the service I got an error which was recorded in windows systems events.最后,由于尝试启动服务失败,我收到了一个错误,该错误记录在 Windows 系统事件中。

Log Name:      System
Source:        Service Control Manager
Date:          2/21/2013 1:58:03 PM
Event ID:      7024
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      User-PC
Description:
The Apache2.4 service terminated with service-specific error Incorrect function.

Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Service Control Manager" Guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" />
    <EventID Qualifiers="49152">7024</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8080000000000000</Keywords>
    <TimeCreated SystemTime="2013-02-21T18:58:03.723988900Z" />
    <EventRecordID>87756</EventRecordID>
    <Correlation />
    <Execution ProcessID="560" ThreadID="7596" />
    <Channel>System</Channel>
    <Computer>User-PC</Computer>
    <Security />
  </System>
  <EventData>
    <Data Name="param1">Apache2.4</Data>
    <Data Name="param2">%%1</Data>
  </EventData>
</Event>

The error from the attempt to start says that beacause of lack of access, make-sock could not bind to sockets which to me looked like localhost port 80. For example,尝试启动时出现的错误表示,由于无法访问,make-sock 无法绑定到在我看来像 localhost 端口 80 的套接字。例如,

  (OS 10013)An attempt was made to access a socket in a way forbidden by its acces
    s permissions.  : AH00072: make_sock: could not bind to address [::]:80

Can anyone tell what I am doing wrong?谁能告诉我我做错了什么?

Sorry for the belabored question.抱歉问这个问题。 To solve my problem I just told apache 2.4 to listen to a different port in httpd.conf.为了解决我的问题,我只是告诉 apache 2.4 在 httpd.conf 中监听不同的端口。 Since System was using pid 4 which was listening on port 80, I did not want to explore this any further.由于 System 正在使用侦听端口 80 的 pid 4,因此我不想进一步探讨这一点。

I put the following into httpd.conf.我将以下内容放入 httpd.conf。 Listen 127.0.0.1:122听 127.0.0.1:122

The most likely culprit is Microsoft Internet Information Server.最有可能的罪魁祸首是 Microsoft Internet Information Server。 You can stop the service from the command line on Windows 7/Vista:您可以在 Windows 7/Vista 上从命令行停止该服务:

net stop was /y净止损是 /y

or XP:或经验值:

net stop iisadmin /y净停止 iisadmin /y

read thishttp://www.sitepoint.com/unblock-port-80-on-windows-run-apache/阅读此http://www.sitepoint.com/unblock-port-80-on-windows-run-apache/

I have the same problem too, after upgrading win7 to win10.我也有同样的问题,升级win7到win10后。 then I check services.msc and found " World Wide Web Publishing Service " was running automatically by default.然后我检查services.msc,发现“万维网发布服务”在默认情况下自动运行。 So then I disabled it, and running the Apache service again.然后我禁用了它,并再次运行 Apache 服务。

Port 80 maybe used by Microsoft HTTPAPI

Try to stop the following service:
  Web Deployment Agent Service
  SQL Server Reporting Service
  SQL Server VSS Writer

I solved this issue finally, it was because of some systems like skype and system processes take that port 80, you can make check using netstat -ao for port 80我终于解决了这个问题,这是因为某些系统如skype和系统进程占用了该端口80,您可以使用netstat -ao检查端口80

Kindly find the following steps请找到以下步骤

  1. After installing your Apache HTTP go to the bin folder using cmd安装 Apache HTTP 后,使用 cmd 转到 bin 文件夹

  2. Install it as a service using httpd.exe -k install even when you see the error never mind使用 httpd.exe -k install 将其安装为服务,即使您看到错误也没关系

  3. Now make sure the service is installed (even if not started) according to your os现在确保根据您的操作系统安装了服务(即使没有启动)

  4. Restart the system, then you will find the Apache service will be the first one to take the 80 port,重启系统,然后你会发现Apache服务会第一个走80端口,

Congratulations the issue is solved.恭喜问题解决了。

if you are using windows os and believe that skype is not the suspect, then you might want to check the task manager and check the "Show processes from all users" and make sure that there is NO entry for httpd.exe.如果您使用的是 Windows 操作系统并且认为 Skype 不是嫌疑犯,那么您可能需要检查任务管理器并检查“显示所有用户的进程”并确保没有 httpd.exe 条目。 Otherwise, end its process.否则,结束其进程。 That solves my problem.那解决了我的问题。

So, that is why i do a two (or more) post.所以,这就是我发两个(或更多)帖子的原因。

I was having the same problem when starting the service (logs can not be opened).我在启动服务时遇到了同样的问题(无法打开日志)。

I thought it was because i was trying to have htdocs inside a VeraCrypt encripted container, absurd since i hace such contained mounted and i use a juntion to not affect paths.我认为这是因为我试图在 VeraCrypt 加密的容器中安装 htdocs,这很荒谬,因为我已经安装了这样的容器,并且我使用了一个连接来不影响路径。

The i read the cause could be low ram: after some tests i get to the next conclusion.我读到的原因可能是内存不足:经过一些测试,我得出了下一个结论。

Windows is not sending pages to virtual ram to free enough ram if it is a service, for applications it is doing it, i have more than 200GiB of pagefile ready to be used as virtual ram in a 4GiB 64 Bit windows 10. Windows 不会将页面发送到虚拟内存以释放足够的内存(如果它是一项服务),对于它正在执行的应用程序,我有超过 200GiB 的页面文件准备用作 4GiB 64 位 Windows 10 中的虚拟内存。

My solution:我的解决方案:

  1. Run a free utility that free ram (512MiB in my test)运行一个免费的实用程序来释放内存(在我的测试中为 512MiB)
  2. Inmediatly after start the service, it starts with no errors启动服务后立即启动,没有错误

Real Cause:真正的原因:

  • I was using a virtual machine that uses 1/2 physical free ram (1.5GiB)我使用的是使用 1/2 物理可用内存 (1.5GiB) 的虚拟机

Hope this help others.希望这对其他人有帮助。

I was also facing the same issue, then i tried restarting my system after every change and it worked for me:我也遇到了同样的问题,然后我尝试在每次更改后重新启动系统,它对我有用:

  1. Uninstall Apache2.4 in cmd prompt (run administrator) with the command: httpd -k uninstall .在 cmd 提示符(运行管理员)中使用以下命令卸载 Apache2.4: httpd -k uninstall
  2. Restart the system.重新启动系统。
  3. open cmd prompt (run administrator) with the command: httpd -k install .使用以下命令打开 cmd 提示符(运行管理员): httpd -k install
  4. Then httpd -k install .然后httpd -k install

Hope you find useful.希望你觉得有用。

you can solve it你可以解决它

sudo nano /etc/apache2/ports.conf

and changed Listen to 8080并更改为收听 8080

In my case, it was due to an IP address that Apache is listening to.就我而言,这是由于 Apache 正在侦听的 IP 地址。 Previously I have set it to 192.168.10.6 and recently Apache service is not running.以前我将它设置为 192.168.10.6,最近 Apache 服务没有运行。 I noticed that due to My laptop wifi changed recently and new IP is different.我注意到由于我的笔记本电脑 wifi 最近发生了变化,新 IP 有所不同。 After fixing the wifi IP to laptop previous IP, Apache service is running again without any error.将wifi IP固定到笔记本电脑以前的IP后,Apache服务再次运行,没有任何错误。

Also if you don't want to change wifi IP then remove/comment that hardcode IP in httpd.conf file to resolve conflict.此外,如果您不想更改 wifi IP,请在 httpd.conf 文件中删除/注释该硬编码 IP 以解决冲突。

This may be because of shortage in physical RAM.这可能是因为物理 RAM 不足。

Check minimum system requirements in the docs and try to close unnecessary programs if possible.检查文档中的最低系统要求,并在可能的情况下尝试关闭不必要的程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM