php Apache 服务器安装失败(端口 80 或 443 已在使用中)

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

Apache server Installation failed(Port 80 or 443 already in use)

phpapache

提问by mani rajput

I have a question related to PHP. I am .net developer. I usually work on asp.net and c#.I installed Visual Studio and SQL Server in my laptop.Now I am trying to Install Xampp server on my system. Here I getting some problem.After Installation When it check for port. It show me message port 80 or 443 aleardy in use apache server installation is failed. I Guess it is happening due to IIS installed in my system. I stopped the IIS and Installed it again But the same problem is coming again. I uninstall the Skype too for this but nothing is working for me. Please tell me why this is happening and what is the solution for this. I hope you understand what is my problem. Please help me for this

我有一个关于 PHP 的问题。我是 .net 开发人员。我通常在 asp.net 和 c# 上工作。我在我的笔记本电脑上安装了 Visual Studio 和 SQL Server。现在我正在尝试在我的系统上安装 Xampp 服务器。在这里我遇到了一些问题。安装后当它检查端口时。它显示消息端口 80 或 443 aleardy in use apache server installation is failed。我猜这是由于我的系统中安装了 IIS 而发生的。我停止了 IIS 并再次安装了它但是同样的问题又来了。我也为此卸载了 Skype,但没有任何效果。请告诉我为什么会发生这种情况以及对此的解决方案是什么。我希望你明白我的问题是什么。请帮我解决这个问题

回答by Ajith S

Fix for this Problem:

修复此问题:

Open up Skypeand go to Toolsand selectOptions. From the list that appears select Advancedand then Connection. There will probably be a check mark inside where it says “Use port 80 and 443 as alternatives for incoming connections”just unchecked that box and save your changes. Skypewill still function normally and now XAMPPwill be able to use port 80 to run.

打开Skype并转到Toolsselect选项。从出现的列表中选择Advanced,然后选择Connection。里面可能会有一个复选标记,它表示“Use port 80 and 443 as alternatives for incoming connections”只是取消选中该框并保存您的更改。Skype仍将正常运行,现在XAMPP将能够使用端口 80 运行。

Useful link

有用的链接

if you have no Skypeinstalled

如果你没有Skype安装

  • Locate the file httpd.conf. This file should be found in C:\xampp\apache\conf(or whichever directory you installed XAMPP.

  • Open the file using a text editor.

  • Locate the line that says Listen 80.

  • Change the port number (80)to a different number(eg. 1234).

  • Restart the Apache Serverto have the change take effect. Do this
    by clicking on the Stopbutton on the XAMPPcontrol panel and
    then clicking on the Startbutton.

  • When you connect to the ApacheServer, you will have to append
    the port number to the URL, previously where you typed localhost, you will now have to type localhost:1234

  • 找到该文件httpd.conf。此文件应位于 C:\xampp\apache\conf(或您安装XAMPP.

  • 使用text editor.打开文件。

  • 找到显示Listen 80.

  • 将端口号更改(80)为不同的数字(例如 1234)。

  • 重新启动Apache Server以使更改生效。做到这一点
    通过点击Stop该按钮XAMPP控制面板,
    然后点击Start按钮。

  • 当您连接到Apache服务器时,您必须append
    将端口号设置为URL,以前您在其中键入localhost,现在您必须键入localhost:1234

Another Useful link

另一个有用的链接

回答by Sami

Solution 1:

解决方案1:

Close the programs running on port 80, it may be one like SKYPE

关闭80端口运行的程序,可能是SKYPE之类的

For Command Line quit

对于命令行退出

In Windows

在 Windows 中

for /f "tokens=5" %a in ('netstat -aon ^| find ":80" ^| find "LISTENING"') do taskkill /f /pid %a

In linux just use

在linux中只需使用

sudo fuser -k 80/tcp

Install wamp(win), lamp(linux) or mamp(mac).. Installation would not be failed even your ports are in use.

安装 wamp(win)、lamp(linux) 或 mamp(mac)。即使您的端口正在使用,安装也不会失败。

Solution 2:

解决方案2:

After installation launch the program. left click the wamp icon in taskbar tray it will show a menu

安装后启动程序。左键单击任务栏托盘中的 wamp 图标,它将显示一个菜单

=> go to apache => go to httpd.config click it to open..

=> 去 apache => 去 httpd.config 点击它打开..

Find(Ctrl+F) listen:80and replace it with listen port_numberlike listen:88or listen:96etc.

查找(Ctrl + F)listen:80并将其替换为listen port_numberlikelisten:88listen:96etc。

again click on wamp icon.. click restart all services.

再次单击 wamp 图标.. 单击重新启动所有服务。

Your apache would be fine

你的 apache 会没事的

回答by Vineet1982

There are many tools which would let you know which program is using port 80 or 443 already. But I prefer a simple command to do so. Open up a command prompt then type.

有许多工具可以让您知道哪个程序已经在使用端口 80 或 443。但我更喜欢一个简单的命令来做到这一点。打开命令提示符,然后键入。

netstat -a

It will let you know which program is using port 80 and for an explanation of all options.

它将让您知道哪个程序正在使用端口 80 并解释所有选项。

netstat /?

Second Part of the question to Change the Apache port. You have to change the settings in apache httpd.conf settings from:

更改 Apache 端口问题的第二部分。您必须从以下位置更改 apache httpd.conf 设置中的设置:

Listen 80
ServerName localhost:80

to

Listen 8012
ServerName localhost:8012

Then try to run in web browser as http://localhost:8012

然后尝试在网络浏览器中运行 http://localhost:8012

回答by MohammadAliDiab

Another solution without changing skype: ( for port 443 )

另一种不改变Skype的解决方案:(端口443)

First, port 443 is the HTTPS default port. you need to change that on the server to something else ( ex 4433 ). But in this case , you must specify that new port every time you want to use HTTPS requests ex :

首先,端口 443 是 HTTPS 默认端口。您需要在服务器上将其更改为其他内容(例如 4433 )。但在这种情况下,每次要使用 HTTPS 请求时都必须指定新端口,例如:

"https://localhost:4433"   .just typing "https://localhost" will NOT work. 

So to change the port , go to folder "htdocs" in the Apache server , and use something like "notepad++" to replace all :443 by :4433. These ports should be in "httpd-sni.conf" and 'httpd-ssl.conf"

因此,要更改端口,请转到 Apache 服务器中的文件夹“htdocs”,然后使用“notepad++”之类的内容将所有 :443 替换为 :4433。这些端口应该在“httpd-sni.conf”和“httpd-ssl.conf”中

I think it is ok to make the change as you are in a development environment.

我认为在开发环境中进行更改是可以的。

回答by Talha Imam

As it says - the port 80 and 443 are already in use. It means that the ports 80 and 443 are already in use by some other server or application. When i faced this issue, it was wamp server that was using these ports(not skype in my case).

正如它所说 - 端口 80 和 443 已经在使用中。这意味着端口 80 和 443 已被某些其他服务器或应用程序使用。当我遇到这个问题时,是 wamp 服务器在使用这些端口(在我的例子中不是 Skype)。

What i did to resolve this is that I changed the ports for xampp.

我为解决这个问题所做的是更改了 xampp 的端口。

How:

如何:

  1. I configured the httpd.conf & httpd-ssl.conf files for Apache.
  2. I changed values for Listen 80(where 80 is the port number) to another random port number(I chose 88) in httpd.conf file.
  3. I changed values for Listen 443(where 443 is the port number) to another random port number(I chose 4433) in httpd-ssl.conf file.
  1. 我为 Apache 配置了 httpd.conf 和 httpd-ssl.conf 文件。
  2. 我在 httpd.conf 文件中将 Listen 80(其中 80 是端口号)的值更改为另一个随机端口号(我选择了 88)。
  3. 我在 httpd-ssl.conf 文件中将 Listen 443(其中 443 是端口号)的值更改为另一个随机端口号(我选择了 4433)。

Make sure you Apache server doesnt use the ports 80 and 443 anywhere in the configuration files, then it will work fluently.

确保你的 Apache 服务器没有在配置文件中的任何地方使用端口 80 和 443,然后它就会流畅地工作。

回答by David Teta

type:

类型:

net stop was /y

in command prompt as administrator

在命令提示符下以管理员身份

admin command prompt

管理员命令提示符

回答by Abolfazl Miadian

just go to apache directory and search to find 'httpd-ssl.conf' and open it then search to find 443, you find 3, edit all of them to another number, i edit to 886. then save file and try to run apache.

只需转到apache目录并搜索找到'httpd-ssl.conf'并打开它然后搜索找到443,你找到3个,将它们全部编辑为另一个数字,我编辑为886。然后保存文件并尝试运行apache .