windows XAMPP - PID 为 4 的“无法打开进程”正在使用端口 80!12

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

XAMPP - Port 80 in use by "Unable to open process" with PID 4! 12

windowsapachexampp

提问by user3097839

I have been trying to figure out how to fix this problem for two days. I'm new to this kind of thing so I would appreciate it if someone could tell me how to fix it.

这两天我一直在想办法解决这个问题。我对这种事情很陌生,所以如果有人能告诉我如何解决它,我将不胜感激。

I've tried deleting skype but that didn't work, I've tried turning off the world wide web thing off, IIS off nothing seems to work.

我试过删除Skype,但没有用,我试过关闭万维网,关闭IIS似乎没有任何效果。

12:51:22 PM  [Apache]   Problem detected!
12:51:22 PM  [Apache]   Port 80 in use by "Unable to open process" with PID 4!
12:51:22 PM  [Apache]   Apache WILL NOT start without the configured ports free!
12:51:22 PM  [Apache]   You need to uninstall/disable/reconfigure the blocking application
12:51:22 PM  [Apache]   or reconfigure Apache and the Control Panel to listen on a different port

回答by Vo Quoc Cuong

  1. Open a CMD prompt as administrator and execute the following command:

    net stop was /y
    
  2. Open the Run dialog box (press Win+R), then type: services.msc

    Then search for World Wide Web Publishing Service(WWW-Publishing Service) and Web Deployment Agent Serviceand stop them. You should also disable them.

  3. Start Apache again with XAMPP :)

  1. 以管理员身份打开 CMD 提示符并执行以下命令:

    net stop was /y
    
  2. 打开运行对话框(按Win+ R),然后输入:services.msc

    然后搜索万维网发布服务(WWW-Publishing Service)和Web部署代理服务并停止它们。您还应该禁用它们。

  3. 使用 XAMPP 再次启动 Apache :)

Link Ref: https://www.sitepoint.com/unblock-port-80-on-windows-run-apache/

链接参考:https: //www.sitepoint.com/unblock-port-80-on-windows-run-apache/

回答by gtr1971

Another very easy option is to simply set Apache to listen on a different port. This can be done by clicking on the "Config" button on the same line as the "Apache" module, select the "httpd.conf" file in the dropdown, then change the "Listen 80" line to "Listen 8080". Save the file and close it.

另一个非常简单的选择是简单地将 Apache 设置为侦听不同的端口。这可以通过单击“Apache”模块所在行上的“Config”按钮,在下拉列表中选择“httpd.conf”文件,然后将“Listen 80”行更改为“Listen 8080”来完成。保存文件并关闭它。

Now it avoids Port 80 and uses Port 8080 instead without issue. The only additional thing you need to do is make sure to put localhost:8080in the browser so the browser knows to look on Port 8080. Otherwise it defaults to Port 80 and won't find your local site.

现在它避免了端口 80 并使用端口 8080 而没有问题。您需要做的唯一额外的事情是确保放入localhost:8080浏览器,以便浏览器知道查看端口 8080。否则它默认为端口 80,不会找到您的本地站点。

This will also require you to restart Apache for the change to take effect.

这还需要您重新启动 Apache 以使更改生效。

Voila! Fixed.

瞧!固定的。

回答by Ogglas

In httpd.conf change the following lines and then restart the application:

在 httpd.conf 中更改以下几行,然后重新启动应用程序:

  • Listen 80to Listen 8080
  • ServerName localhost:80to ServerName localhost:8080
  • Listen 80Listen 8080
  • ServerName localhost:80ServerName localhost:8080

When you press "Start" the application can still say that you have an error like "Port 80 in use by "Unable to open process" with PID..." but it will still work.

当您按“开始”时,应用程序仍然会说您有错误,例如“端口 80 正在被 PID 的“无法打开进程”使用...”但它仍然可以工作。

If the error includes "Port 443 in use by "Unable to open process" with PID..." you need to change both httpd.conf and httpd-ssl.conf.

如果错误包括“端口 443 正在被带有 PID 的“无法打开进程”使用...”,您需要更改 httpd.conf 和 httpd-ssl.conf。

In httpd-ssl.conf change:

在 httpd-ssl.conf 更改:

  • Listen 443to Listen 4433
  • <VirtualHost _default_:443>to <VirtualHost _default_:4433>
  • ServerName www.example.com:443to ServerName www.example.com:4433
  • Listen 443Listen 4433
  • <VirtualHost _default_:443><VirtualHost _default_:4433>
  • ServerName www.example.com:443ServerName www.example.com:4433

回答by chridam

Extracted from this article:

摘自这篇文章

  1. Go to your run command and enter:

    netstat -o -n -a | findstr 0.0:80

  1. 转到您的运行命令并输入:

    netstat -o -n -a | findstr 0.0:80

The last number here is the process ID using it. This is most often IIS or other web relates service and is easy to resolve, but every so often (very often it would seem looking around on google) it appears to be PID 4 – which according to the Windows Task Manager is the NT Kernel and System. Not very helpful given killing this will result in a blue screen of death.

这里的最后一个数字是使用它的进程 ID。这通常是 IIS 或其他与 Web 相关的服务并且很容易解决,但每隔一段时间(它似乎经常在谷歌上环顾四周)它似乎是 PID 4——根据 Windows 任务管理器,它是 NT 内核和系统。鉴于杀死它会导致蓝屏死机,这不是很有帮助。

The thing hogging port 80 has nothing to do with IIS or web anything, it's SQL Server Reporting Services. Turn off anything that resembles a SQL Server Services and start Apache again, no need for a reboot.

占用端口 80 的东西与 IIS 或 Web 无关,它是 SQL Server Reporting Services。关闭任何类似于 SQL Server 服务的内容并再次启动 Apache,无需重新启动。

So problems with PID 4 listening to port 80? Check your SQL services and turn them off.

那么 PID 4 侦听端口 80 有问题吗?检查您的 SQL 服务并将其关闭。

UPDATE- Comment from @sangam:

更新- 来自@sangam 的评论:

Worked at a shot. In my case, it turned out to be SQL server reporting services. I stopped the service for all the installed instances, and it worked (without machine reboot).

一拍即合。就我而言,结果是 SQL 服务器报告服务。我停止了所有已安装实例的服务,并且它工作正常(无需重启机器)。

回答by Stephen Burrows

You might need to stop the "Web Deployment Agent Service"

您可能需要停止“Web 部署代理服务”

Press Win+R and type services.msc

按 Win+R 并键入 services.msc

Right click on Web Deployment Agent Service and select "Stop"

右键单击 Web 部署代理服务并选择“停止”

Restart XAMPP

重启 XAMPP

Also after double clicking "Web Deployment Agent Service" you can make the Startup type to Manual, So that "Web Deployment Agent Service" will not start automatically

也可以双击“Web Deployment Agent Service”将启动类型设置为Manual,这样“Web Deployment Agent Service”就不会自动启动

回答by Peter T.

So I have faced the same problem when trying to start Apache service and I would like to share my solutions with you. Here are some notes about services or programs that may use port 80:

所以我在尝试启动 Apache 服务时遇到了同样的问题,我想与您分享我的解决方案。以下是有关可能使用端口 80 的服务或程序的一些注意事项:

  1. Skype: Skype uses port 80/443 by default. You can change this from Tools -> Options -> Advanced -> Connectionsand disable the checkbox "use port 80 and 443 for addtional incoming connections".

  2. IIS: IIS uses port 80 be default so you need to shut it down. You can use the following two commands: net stop w3svc, net stop iisadmin.

  3. SQL Server Reporting Service: You need to stop this service because it may take port 80 if IIS is not running. Go to local services and stop it.

  4. VMware Workstation: If you are running VMware Workstation, you need to stop the VMware Workstation server - port 443 as well.

  1. Skype: Skype 默认使用端口 80/443。您可以更改此设置Tools -> Options -> Advanced -> Connections并禁用复选框“将端口 80 和 443 用于其他传入连接”

  2. IIS: IIS 默认使用端口 80,因此您需要将其关闭。您可以使用以下两个命令:net stop w3svc, net stop iisadmin.

  3. SQL Server Reporting Service:您需要停止此服务,因为如果 IIS 未运行,它可能会占用端口 80。转到本地服务并停止它。

  4. VMware Workstation:如果您正在运行 VMware Workstation,则还需要停止 VMware Workstation 服务器 - 端口 443。

These options work great with me and I can start Apache service without errors.

这些选项非常适合我,我可以毫无错误地启动 Apache 服务。

The other option is to change Apache listen port from httpd.confand set another port number.

另一个选项是从httpd.conf更改 Apache 侦听端口并设置另一个端口号。

Hope this solution helps anyone who faces the same problem again.

希望这个解决方案可以帮助任何再次面临同样问题的人。

回答by wildebeest

  1. Open Task Manager (Ctrl+Alt+Delete).
  2. Go to "Details" tab.
  3. Sort by PID number.
  4. End process that is using PID number indicated in error.
  5. Restart XAMPP.
  1. 打开任务管理器(Ctrl+Alt+Delete)。
  2. 转到“详细信息”选项卡。
  3. 按PID编号排序。
  4. 正在使用错误指示的 PID 编号的结束进程。
  5. 重新启动 XAMPP。

回答by Hammad Khan

As there is comment by @johnkarka on the question, this port is used by SQL Server reporting service as well. After stopping this, Apache started fine.

由于@johnkarka 对此问题发表了评论,因此 SQL Server 报告服务也使用此端口。停止此操作后,Apache 开始正常。

  1. Go to "SQL Server Configuration Manager"
  2. Click on "SQL Server Reporting Service" and stop it
  1. 转到“SQL Server 配置管理器”
  2. 单击“SQL Server Reporting Service”并停止它

enter image description here

在此处输入图片说明

The funny thing is IIS was working fine in same configuration but not Apache, had to stop SQL Reporting service to make it work on default port (80).

有趣的是 IIS 在相同的配置中运行良好,但在 Apache 中运行良好,必须停止 SQL Reporting 服务才能使其在默认端口 (80) 上运行。

回答by midoriha_senpai

What worked for me was stopping the Internet Information Services (IIS). If you are using Windows 7, click on your Start button and in your search box, type "iis". Click on "Internet Information Services (IIS) Manager". When the window pops up, and assuming you've got none of the icons selected, you should just be able to click Stop on the right action pane. My XAMPP Apache started right up. Hope it all worked out for you.

对我有用的是停止 Internet 信息服务 (IIS)。如果您使用的是 Windows 7,请单击“开始”按钮,然后在搜索框中键入“iis”。单击“Internet 信息服务 (IIS) 管理器”。当窗口弹出时,假设您没有选择任何图标,您应该能够单击右侧操作窗格上的停止。我的 XAMPP Apache 立即启动。希望这一切对你有用。

回答by N.P

In windows 10, to free up port 80:

在 Windows 10 中,要释放端口 80:

in my case, I open "Services" from "Search Windows" (on the left corner on screen), then stop all of SQL server services MSSQLSERVER and it works again

就我而言,我从“搜索窗口”(在屏幕左上角)打开“服务”,然后停止所有 SQL 服务器服务 MSSQLSERVER 并再次运行