简体   繁体   English

如何解决“错误:Apache 意外关闭”?

[英]How to solve "Error: Apache shutdown unexpectedly"?

I've just re-installed XAMPP, and when I try to start my Apache server in the XAMPP Control Panel, I now get the following errors:我刚刚重新安装了 XAMPP,当我尝试在 XAMPP 控制面板中启动我的 Apache 服务器时,我现在收到以下错误:

16:50:25  [Apache]     Status change detected: running
16:50:26  [Apache]     Status change detected: stopped
16:50:26  [Apache]     Error: Apache shutdown unexpectedly.
16:50:26  [Apache]     This may be due to a blocked port, missing dependencies,
16:50:26  [Apache]     improper privileges, a crash, or a shutdown by another method.
16:50:26  [Apache]     Press the Logs button to view error logs and check
16:50:26  [Apache]     the Windows Event Viewer for more clues
16:50:26  [Apache]     If you need more help, copy and post this
16:50:26  [Apache]     entire log window on the forums

How do I solve this?我该如何解决这个问题?

As I am working in a corporate environment where developers faces firewall issues, none of the other answers resolved my issue.当我在开发人员面临防火墙问题的公司环境中工作时,其他答案都没有解决我的问题。

As the port is not used by Skype, but by some other internal applications, I followed the below steps to resolve the issue:由于 Skype 不使用该端口,但其他一些内部应用程序使用该端口,我按照以下步骤解决了该问题:

Step 1 - From the XAMPP Control Panel, under Apache, click the Config button, and select the Apache (httpd.conf).第 1 步- 从 XAMPP 控制面板的 Apache 下,单击 Config 按钮,然后选择 Apache (httpd.conf)。

Inside the httpd.conf file, somehow I found a line that says:httpd.conf文件中,不知何故我发现了一行:

Listen 80

And change the 80 into any number / port you want.并将 80 更改为您想要的任何数字/端口。 In my scenario I'm using port 8080.在我的场景中,我使用的是 8080 端口。

Listen 8080

Still from the httpd.conf file, I found another line that says:仍然从httpd.conf文件中,我发现另一行说:

ServerName localhost:80

Change 80 to 8080.将 80 更改为 8080。

ServerName localhost:8080

Step 2 - From the XAMPP Control Panel, under Apache, click the Config button again, but this time select the Apache ( httpd-ssl.conf ).第 2 步- 从 XAMPP 控制面板的 Apache 下,再次单击 Config 按钮,但这次选择 Apache ( httpd-ssl.conf )。 Inside the httpd-ssl.conf file, find line that sayshttpd-ssl.conf文件中,找到说

Listen 443

And change the 443 into any number / port you want.并将 443 更改为您想要的任何数字/端口。 I'll using 4433 as the new port number.我将使用4433作为新的端口号。

Listen 4433

Still from the httpd-ssl.conf file, find another line that says仍然从httpd-ssl.conf文件中,找到另一行说

<VirtualHost _default_:443>

ServerName localhost:443

And change 443 to 4433 .并将443更改为4433

<VirtualHost _default_:4433>

ServerName localhost:4433

Remember to save the httpd.conf and httpd-ssl.conf files after performing some changes.请记住在执行一些更改后保存httpd.confhttpd-ssl.conf文件。 Then restart the Apache service.然后重新启动 Apache 服务。

Open Skype.打开 Skype。

Tools -> Options -> Advanced -> Connection.工具 -> 选项 -> 高级 -> 连接。

Uncheck the " Use port 80 and 443 for alternatives for incoming connections " checkbox取消选中“使用端口 80 和 443 替代传入连接”复选框

Sign Out and Close all Skype windows.注销并关闭所有 Skype 窗口。 Try restarting your Apache.尝试重新启动您的 Apache。

In XAMPP Control Panel V3.2.1, click on "NetStat" button on top right.在 XAMPP 控制面板 V3.2.1 中,单击右上角的“NetStat”按钮。 Make sure port 80 is not used by any other program.确保端口 80 未被任何其他程序使用。 Then click on "Shell" Right below it.然后单击它正下方的“Shell”。 Issue this command in the shell prompt;在 shell 提示符下发出此命令;

Apache_Start.bat Apache_Start.bat

or type "ap" then tab the TAB key two times which will similarly generate the above command.或键入“ap”,然后按两次 TAB 键,这将类似地生成上述命令。 You will actually see the exact error why Apache failed.您实际上会看到 Apache 失败的确切错误。 It will be mostly likely virtual host configuration issue or may be something else.这很可能是虚拟主机配置问题,或者可能是其他问题。 It will display the line number on which the error is occurring.它将显示发生错误的行号。 Just fix that error.只需修复该错误。 Note that in RootDocument a trailing \ can be a source of error as well.请注意,在 RootDocument 中,结尾的 \ 也可能是错误的来源。 Remove any trailing "".删除任何尾随“”。

One thing you can do is to stop the services on port 80 by issuing您可以做的一件事是通过发出停止端口 80 上的服务

net stop http

in a cmd.在一个cmd中。 You'll be asked if you're sure you want to stop those services.系统会询问您是否确定要停止这些服务。 I found out that I had a few services I wasn't using and disabled them.我发现我有一些服务我没有使用并禁用它们。

To see who else is using port 80 type in a cmd要查看还有谁在使用端口 80,请在 cmd 中键入

netstat -abno

I'm assuming you want to run Apache on port 80. If this is the case and you want to keep the conflicting services you will need to associate them to a new port.我假设您想在端口 80 上运行 Apache。如果是这种情况并且您想保留冲突的服务,您需要将它们关联到一个新端口。

If the problem is not a busy port you can also try the following: select "show debug information" in the XAMPP config panel.如果问题不是端口繁忙,您还可以尝试以下操作:在 XAMPP 配置面板中选择“显示调试信息”。 When starting Apache you'll be shown something like "Executing "c:\xampp\apache\bin\httpd.exe". If you run that启动 Apache 时,您会看到类似“正在执行”c:\xampp\apache\bin\httpd.exe。如果你运行它

c:\xampp\apache\bin\httpd.exe

in a cmd you will get some more information (I once for instance had some issue with my httpd.conf file).在 cmd 中,您将获得更多信息(例如,我曾经对我的 httpd.conf 文件有一些问题)。

Related: How do I free my port 80 on localhost Windows?相关:如何在 localhost Windows 上释放我的端口 80? and Apache won't run in xampp并且Apache 不会在 xampp 中运行

Follow these steps:按着这些次序:

  1. Open your XAMPP control panel then click its "Config"打开您的 XAMPP 控制面板,然后单击其“配置”
  2. Choose the "Apache (httpd.conf)" and find this code below and change it into this one:选择“Apache (httpd.conf)”并在下面找到此代码并将其更改为以下代码:

    #Change this to Listen on specific IP addresses as shown below #将此更改为侦听特定IP地址,如下所示

    #to prevent Apache from glomming onto all bound IP addresses. #以防止 Apache 进入所有绑定的 IP 地址。

    #Listen 0.0.0.0:80 #听 0.0.0.0:80

    #Listen [::]:80 #听 [::]:80

    Listen 80

    # Dynamic Shared Object (DSO) Support # 动态共享对象 (DSO) 支持

    1. Save it ( Ctrl + S )保存它( Ctrl + S
    2. After that, go back to the XAMPP control panel and click its config again.之后,返回 XAMPP 控制面板并再次单击其配置。
    3. Choose "Apache (httpd-ssl.conf)", find this code below, and change it again:选择“Apache (httpd-ssl.conf)”,在下面找到这段代码,再次修改:

    # Note: Configurations that use IPv6 but not IPv4-mapped addresses need two # 注意:使用 IPv6 但不使用 IPv4 映射地址的配置需要两个

    # Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443" # 监听指令:“Listen [::]:443”和“Listen 0.0.0.0:443”

    # #

    #Listen 0.0.0.0:443 #听 0.0.0.0:443

    #Listen [::]:443 #听 [::]:443

    Listen 443

    1. Save it ( Ctrl + S )保存它( Ctrl + S
    2. Then, click the "config" (note: above the netstat) and click the "service and port settings".然后,单击“配置”(注意:在 netstat 上方)并单击“服务和端口设置”​​。
    3. Change "Main Port" to 8080 and "SSL Port" to 4433, then save it.将“主端口”更改为 8080,将“SSL 端口”更改为 4433,然后保存。
    4. Finally, go to the "control panel" -> "Programs & Features" -> "Turn Windows On or Off".最后,转到“控制面板”->“程序和功能”->“打开或关闭 Windows”。
    5. Uncheck your "Internet Information Services", and then click OK.取消选中“Internet 信息服务”,然后单击“确定”。

Just wait for it and your computer/laptop will be automatically restart and try to open your XAMPP control panel again, and then start your Apache.等待它,您的计算机/笔记本电脑将自动重新启动并尝试再次打开您的 XAMPP 控制面板,然后启动您的 Apache。

My problem was that in httpd.conf the DocumentRoot and <Directory> entries were pointing to non-existing folders.我的问题是在 httpd.conf 中DocumentRoot<Directory>条目指向不存在的文件夹。

For example, the 'original' httpd.conf had the following entries:例如,“原始”httpd.conf 具有以下条目:

DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">

If you've installed in C:\xampp then you need to change those entries to match, ie如果您已安装在 C:\xampp 中,则需要更改这些条目以匹配,即

DocumentRoot "c:/xampp/htdocs"
<Directory "c:/xampp/htdocs">

This worked for me...这对我有用...

If you are using windows...如果您使用的是窗户...

Search 'cmd' in the windows search bar.在 Windows 搜索栏中搜索“cmd”。

Enter this: C:\xampp\apache\bin\httpd.exe输入: C:\xampp\apache\bin\httpd.exe

Find which file and which line the error occurred.查找发生错误的文件和行。

For example, mine was in the file below on line 37.例如,我的文件在下面第 37 行的文件中。

httpd-multilang-errordoc.conf httpd-multilang-errordoc.conf

Open the code and fix the error by either removing the line or fixing it.打开代码并通过删除该行或修复它来修复错误。

Done!完毕! I should work now.我现在应该工作了。

:) :)

If you're using Windows 7 .如果您使用的是 Windows 7 。 Search for IIS in Windows search (Click the Window icon in left bottom and type in where it says 'Search program and files') .在 Windows 搜索中搜索 IIS(单击左下角的 Window 图标并在其中输入“搜索程序和文件”)。

Open IIS (Internet Information Service) .打开IIS(互联网信息服务)

In the right side in actions panel.在操作面板的右侧。 Click Stop.单击停止。

Note: The stop link is faded in screen shot.注意:停止链接在屏幕截图中淡出。 As I've stopped it.因为我已经阻止了它。 IIS 屏幕截图 Problem Solved!问题解决了!

我遇到了同样的问题,结果我忘了运行setup_xampp.bat (便携版)。

It seems that no one has answered about executing xampp_start.exe.似乎没有人回答有关执行 xampp_start.exe 的问题。

I did all the previous answers but it did not fixed my issue.我做了所有以前的答案,但它并没有解决我的问题。 I found out that running xampp_start.exe will give you a detailed info about the issue.我发现运行 xampp_start.exe 将为您提供有关该问题的详细信息。

This is what I see on my end:这是我最后看到的:

xampp_start

As you can see I was having a path issue or xampp is pointing to non-existing folder.如您所见,我遇到了路径问题或 xampp 指向不存在的文件夹。

The simple thing that you can do is to check if Skype or VMware is installed in your machine or not.您可以做的简单事情是检查您的计算机中是否安装了SkypeVMware

Skype uses port 80 and 443 as an additional port for incoming connections. Skype 使用端口 80 和 443 作为传入连接的附加端口。 To change the port number in Skype, go to要更改 Skype 中的端口号,请转到

Tools > Connection Options > Connection工具 > 连接选项 > 连接

in the Skype window.在 Skype 窗口中。 Now change the default 80 port number to something other.现在将默认的 80 端口号更改为其他端口号。

VMware Workstation uses port 443 for sharing. VMware Workstation使用端口 443 进行共享。 To change this, open VMware Workstation and goto要更改此设置,请打开 VMware Workstation 并转到

Edit > Preferences > Shared Vms编辑 > 首选项 > 共享虚拟机

  1. Click "Change Settings" buton点击“更改设置”按钮
  2. Then Click "Disable Sharing"然后点击“禁用共享”
  3. Then change the https port number being used (443)然后更改正在使用的 https 端口号(443)
  4. Then you can click "Enable Sharing" button然后您可以单击“启用共享”按钮

That's all you have to do.这就是你所要做的。 Restart XAMPP and run the Apache server.重新启动 XAMPP 并运行 Apache 服务器。

When I found that there was no process using port 80 by using commands当我通过命令发现没有进程使用80端口时

netstat -abno | find ":80"

there was not a problem of any process using port 80.使用端口 80 的任何进程都没有问题。

Then I ran command (in cmd)然后我运行命令(在 cmd 中)

C:\xampp\apache\bin\httpd.exe

it showed some error in the virtual hosts configuration in httpd-vhosts.conf file which was recently edited by me for installation in a WordPress PHP environment in the Eclipse IDE.它在httpd-vhosts.conf文件中的虚拟主机配置中显示了一些错误,该文件是我最近编辑的,用于安装在Eclipse IDE 中的 WordPress PHP 环境中。 So I deleted those lines and Apache started perfectly.所以我删除了这些行,Apache 完美启动。

I had the same problem sometime back.我曾经有过同样的问题。 I had a old laptop, on which almost all the ports were either blocked or were malfunctioning.我有一台旧笔记本电脑,几乎所有端口都被阻塞或出现故障。 This is how I did it.我就是这样做的。

  1. Open the XAMPP control panel.打开 XAMPP 控制面板。

  2. Click on Config点击配置

  3. Then, go into Apache httpd.conf file.然后,进入Apache httpd.conf文件。 Open it with a text editor.用文本编辑器打开它。

  4. Search for "80" (Do Ctrl + F and find all of them. Replace it with 8080 or 4040 or 4000 ).搜索“80” (执行Ctrl + F并找到所有这些。将其替换为8080 或 4040 或 4000 )。

  5. Save the file.保存文件。 And restart XAMPP.并重新启动 XAMPP。

It worked well for me, and I hope it helps you too.它对我很有效,我希望它也能帮助你。

For me, world wide web publishing-service was using port 80. I killed this by running the following command on cmd:对我来说,万维网发布服务使用的是 80 端口。我通过在 cmd 上运行以下命令来终止它:

net stop http

After that, XAMPP ran Apache without any problems.之后,XAMPP 运行 Apache 没有任何问题。

原因之一可能是您没有以管理员身份运行 XAMPP 控制面板。

This error occurs because the port, which is allocated for Apache, is used by another program.发生此错误是因为分配给 Apache 的端口被另一个程序使用。 To check the application which uses the port, which we allocated for Apache, it can be had by clicking,要检查使用我们为 Apache 分配的端口的应用程序,可以单击,

Netstat button.网络统计按钮。

XAMPP主页

This is the Netstat file,这是 Netstat 文件,

在此处输入图像描述

At first, I have allocated port 8080 for Apache, and I recently installed Oracle DB.TNSLSNR.exe has used 8080 port now.一开始我为 Apache 分配了 8080 端口,我最近安装了 Oracle DB.TNSLSNR.exe 现在使用了 8080 端口。

So, by looking at this file we can choose a port which is not clashing with other applications.因此,通过查看此文件,我们可以选择一个不与其他应用程序冲突的端口。 In my case, port 8060 is not clashing with any application.就我而言,端口 8060 不会与任何应用程序发生冲突。 By selecting that we can change the httpd.conf file (XAMPP control panel -> Config ) as mentioned above.通过选择我们可以更改httpd.conf文件(XAMPP 控制面板 ->配置),如上所述。

  1. download new xampp apachefriends下载新的 xampp apachefriends
  2. install it安装它
  3. remove all VPN app删除所有 VPN 应用
  4. open folder XAMPP run setup_xampp.bat打开文件夹 XAMPP 运行 setup_xampp.bat
  5. run xampp-control.exe运行 xampp-control.exe

Sometimes the issue is not a port issue but may be due to a misconfiguration that you did and Apache is not logging the error on the Event Viewer in Windows.有时问题不是端口问题,但可能是由于您所做的配置错误并且 Apache 没有在 Windows 的事件查看器上记录错误。 To go around this, simply要解决这个问题,只需

cd C:\xampp\apache\bin

and then run然后运行

httpd.exe

Apache will then spit out the error for you eg as below然后Apache会为你吐出错误,例如如下

AH00526: Syntax error on line 2 of C:/xampp/apache/conf/httpd.conf: Invalid command 'This', perhaps misspelled or defined by a module not included in the server configuration

I hope that helps some poor soul :)我希望这可以帮助一些可怜的灵魂:)

In my case, this issue was caused by an attempt to download other product of bitnami, like WordPress .就我而言,这个问题是由尝试下载其他 bitnami 产品引起的,比如WordPress That's common when we install WordPress via XAMPP.这在我们通过 XAMPP 安装 WordPress 时很常见。 It is placed in the xampp/app directory that can be accessed from the XAMPP application homepage.它位于可以从 XAMPP 应用程序主页访问的xampp/app目录中。

As a solution, I removed the default installed WordPress from the xampp directory and manually installed WordPress in the htdocs folder of WordPress by downloading it and extracting zip files into the htdoc folder.作为解决方案,我从xampp目录中删除了默认安装的 WordPress,并通过下载并将 zip 文件解压缩到htdoc文件夹中,手动将 WordPress 安装在 WordPress 的htdocs文件夹中。 You also need to restart XAMPP or may system after uninstalling/removing the default WordPress .您还需要在卸载/删除默认 WordPress 后重新启动 XAMPP 或可能系统 All is OK for me now.我现在一切都好。

  1. Make at first sure your \xampp folder is in the root!首先确保您的\xampp文件夹位于根目录中! This is important as the path is relative.这很重要,因为路径是相对的。

  2. Then make sure you run the xampp_control.exe with admin rights.然后确保以管理员权限运行xampp_control.exe

  3. Then change the files below to avoid issues with blocked port 80.然后更改以下文件以避免阻塞端口 80 的问题。

In \xampp\xampp-control.ini it should be set:\xampp\xampp-control.ini它应该被设置:

[ServicePorts]
Apache=8080
ApacheSSL=4433

Find \xampp\apache\conf\httpd.conf and set:找到\xampp\apache\conf\httpd.conf并设置:

Listen 8080

ServerName localhost:8080

Find \xampp\apache\conf\extra\httpd-ssl.conf and set:找到\xampp\apache\conf\extra\httpd-ssl.conf并设置:

Listen 4433

<VirtualHost _default_:4433>

ServerName www.example.com:4433

Then end all services and restart xampp-control.exe with admin rights.然后结束所有服务并以管理员权限重新启动xampp-control.exe It should run!它应该运行!

I have just encountered this error on my xampp v3.2.2 [win 10 pro x64],我刚刚在我的 xampp v3.2.2 [win 10 pro x64] 上遇到了这个错误,

I first tried to run the "net stop http" command in an admin cmd, but it didnt solve the issue, so I went ahead to try the "netstat -abno" command and i found out that the ssl port(443) was in use by vmware.我首先尝试在管理员 cmd 中运行“net stop http”命令,但它没有解决问题,所以我继续尝试“netstat -abno”命令,我发现 ssl 端口(443)在由 vmware 使用。

so my advice, don't just look for what's blocking port 80, also look for potential programs using port 443. because I really don't like changing my default port numbers to 8081 and 4433.所以我的建议是,不要只寻找阻塞端口 80 的原因,还要寻找使用端口 443 的潜在程序。因为我真的不喜欢将默认端口号更改为 8081 和 4433。

So this is how you can solve this issue...所以这就是你可以解决这个问题的方法......

firstly type the following command首先输入以下命令

net stop http

then try to start apache, if it still doesn't work.然后尝试启动apache,如果它仍然不起作用。 type out the following command输入以下命令

netstat -abno

and you'll definitely get that troublesome app that's using up your precious port.你肯定会得到那个占用你宝贵端口的麻烦应用程序。

copy the pid and then use the following command复制pid,然后使用以下命令

taskkill /f /pid PID

where PID is the pid you copied.其中 PID 是您复制的 pid。

Hopefully this helps someone.希望这可以帮助某人。

In my case port was already used by windows IIS service.在我的情况下,windows IIS 服务已经使用了端口。 You can check if port is being already used from cmd.您可以从 cmd 检查端口是否已被使用。 Open cmd and run this command:打开 cmd 并运行以下命令:

netstat -ano

If it is being used by IIS you can stop it by following command.如果 IIS 正在使用它,您可以通过以下命令停止它。 Open cmd as administrator, then:以管理员身份打开cmd,然后:

iisreset /stop

Now try running XAMPP, it should work.现在尝试运行 XAMPP,它应该可以工作。

您可以从 XAMPP 目录运行 apache_start.bat 文件以查看有关您的错误详细信息的详细信息。

Try the following, none of the above solved it for me尝试以下,以上都没有为我解决它

Select "Run as administrator"选择“以管理员身份运行”

在此处输入图像描述

Then click on the big left box next to Apache然后点击Apache旁边的大左框

And Choose to uninstall Apache并选择卸载 Apache

在此处输入图像描述

I have no idea why this worked but it solved my problem directly!我不知道为什么会这样,但它直接解决了我的问题!

I solved the problem with stopping the service "Web Deployment Agent Service".我解决了停止服务“Web 部署代理服务”的问题。 Open: System -> Computer Management -> Services -> Web Deployment Agent Service .打开:系统->计算机管理->服务-> Web 部署代理服务 Stop this service and starting XAMPP works.停止此服务并启动 XAMPP 工作。 I think this is a service by MS Webmatrix.我认为这是 MS Webmatrix 的一项服务。

(German: Systemsteuerung -> System und Sicherheit -> Verwaltung -> Dienste -> Webbereitstellungs-Agent-Dienst ) (德语: Systemsteuerung -> System und Sicherheit -> Verwaltung -> Dienste -> Webbereitstellungs-Agent-Dienst

Best solution最佳解决方案

open XAMPP control panel,click on config for Apache, then click on Apache(httpd.config).now in the text editor .打开 XAMPP 控制面板,单击 Apache 的配置,然后在文本编辑器中单击 Apache(httpd.config).now。 ctrl+f --> find "Listen 80" and replace it with "Listen 8079" wtihout the quotations :) but now you have to use it like this http://localhost:8079/ ctrl+f --> 找到 "Listen 80" 并将其替换为 "Listen 8079" 不带引号:) 但现在你必须像这样使用它http://localhost:8079/

PS, I tried to change port settings for skype , stopping the Web Deployment Agent Service which I could not find in windows 10,cmd--> net stop http, and other methods but nothing worked except this . PS,我尝试更改 skype 的端口设置,停止在 windows 10 中找不到的 Web 部署代理服务,cmd--> net stop http 和其他方法,但除此之外没有任何效果。

I had the exact same error message as the OP, but my problem was not addressed by any of the existing answers.我有与 OP 完全相同的错误消息,但任何现有答案都没有解决我的问题。 Many of the answers deal with conflicts on port 80, which I knew I did not have, since I had had localhost responding on port 80 very recently.许多答案都处理端口 80 上的冲突,我知道我没有,因为最近我有 localhost 在端口 80 上响应。

Turns out I had inadvertently changed ServerRoot when I intended to change DocumentRoot (stupid, I know), and though the new ServerRoot directory existed, it did not contain the configuration files and other stuff apache needed, which caused it to fail on startup.原来,当我打算更改DocumentRoot (愚蠢,我知道)时,我无意中更改了ServerRoot ,虽然新的ServerRoot目录存在,但它不包含 apache 所需的配置文件和其他东西,这导致它在启动时失败。 The error message probably addresses this scenario by the wording ' missing dependencies '.错误消息可能通过“缺少依赖项”的措辞来解决这种情况。

On my Windows system, setting ServerRoot back to C:/XAMPP/apache solved the problem.在我的 Windows 系统上,将 ServerRoot 设置回C:/XAMPP/apache解决了这个问题。

The Apache server by default runs on ports 80, 443. Your problem is one or both of the two ports are busy.默认情况下,Apache 服务器在端口 80、443 上运行。您的问题是两个端口中的一个或两个端口都忙。 Usually Skype or VMware Workstation use these two ports.通常 Skype 或 VMware Workstation 使用这两个端口。 So, make sure that they're not running.因此,请确保它们没有运行。 The best way to make sure the ports are free on windows is :确保端口在 Windows 上可用的最佳方法是:

  • Click windows button.单击窗口按钮。

  • In the search bar type resmon , to open the resource monitor resmon.exe .在搜索栏中输入resmon ,打开资源监视器resmon.exe

  • Open Listening Ports , this will show you the opened used ports. Open Listening Ports ,这将显示打开的使用端口。

  • Now you can see which process is using ports 80 and 443.现在您可以看到哪个进程正在使用端口 80 和 443。

  • Then you can kill the process either from CMD using its PID (which is shown in the resource monitor), or directly from Task Manager.然后,您可以使用其 PID(显示在资源监视器中)从 CMD 或直接从任务管理器中终止该进程。

  • To kill a process from CMD using PID type Taskkill /PID 26356 /F , where 26356 is the PID.使用 PID 类型Taskkill /PID 26356 /F从 CMD 终止进程,其中 26356 是 PID。

Best Solution for windows user is : windows用户的最佳解决方案是:

  1. Open netstat (from XAMPP CONTROL PANEL)打开 netstat(来自 XAMPP 控制面板)
  2. Find PID of process which uses port 80.查找使用端口 80 的进程的 PID。
  3. Open CMD with Administrative.使用管理打开 CMD。
  4. Run taskkill /pid PID (instead PID use pid u found from netstat)运行taskkill /pid PID (而不是 PID 使用从 netstat 找到的 pid u)
    Heyy enjoy u Done.....嘿,享受你完成......

Alright, no port 80, no Skype blame!好吧,没有端口 80,没有 Skype 的责备! My problem was indeed quite simple(&silly), I had an extra backslash (\) (on Windows) after the path I'd specified for the DocumentRoot directive, so I made a change like this and the problem is gone like a duck soup.我的问题确实很简单(&傻),在我为 DocumentRoot 指令指定的路径之后,我有一个额外的反斜杠(\)(在 Windows 上),所以我做了这样的改变,问题就像鸭汤一样消失了.

My index.php was in the path "D:\websites\dummy" and my httpd.conf was like this:我的 index.php 在路径“D:\websites\dummy”中,而我的 httpd.conf 是这样的:

<VirtualHost 127.0.0.2:80>
ServerName dummy.local
DocumentRoot "D:\websites\dummy\" #mistake here
</VirtualHost>
<Directory "D:\websites\dummy\"> #mistake here
    Require all granted
</Directory>

So just change those two lines like this:所以只需像这样更改这两行:

#first mistake fix:
DocumentRoot "D:\websites\dummy"
#second (similar) mistake fix:
<Directory "D:\websites\dummy">

...and everything's fine now. ......现在一切都很好。 To prevent such mistakes in future, always copy the path of any folder you want to refer to instead of typing it yourself.为防止将来出现此类错误,请始终复制您要引用的任何文件夹的路径,而不是自己输入。

For me, this problem began when I hosted a VPN-connection on my Windows 8 computer.对我来说,当我在我的 Windows 8 计算机上托管 VPN 连接时,这个问题就开始了。

Simply deleting the connection from "Control Panel\Network and Internet\Network Connections" solved the problem.只需从“控制面板\网络和 Internet\网络连接”中删除连接即可解决问题。

I had the same problem (on Windows 8.1), but I fixed it just by extracting to C:\ instead of C:\somefolder as I did at first.我遇到了同样的问题(在 Windows 8.1 上),但我只是通过解压缩到C:\而不是C:\somefolder来解决它,就像我最初所做的那样。 So the path to the control panel, for example, is now C:\xampp\xampp-control.exe所以控制面板的路径例如现在是C:\xampp\xampp-control.exe

This happend due to default port 80 is blocked for Apache.这是由于 Apache 的默认端口 80 被阻止而发生的。 You need to change the port or make the port accesible.您需要更改端口或使端口可访问。

Go to your Apache configuration (httpd.conf) file in the Apache installation.转到 Apache 安装中的Apache 配置 (httpd.conf)文件。

Find these lines:找到这些行:

# #

Listen 192.168.1.2:80192.168.1.2:80

Listen 8080

# #

Here 192.168.1.2 is my private IP address.这里 192.168.1.2 是我的私有 IP 地址。 Change it according to yours.根据你的改变它。

Change as below更改如下

Listen 192.168.1.2:8081收听 192.168.1.2:8081

Listen 8081听 8081

Now when you access localhost you have to add the port explicitily as http://localhost:8081/ ...现在,当您访问 localhost 时,您必须将端口显式添加为http://localhost:8081/ ...

Note that whenever you change the default ports, your browser will not know about that.请注意,无论何时更改默认端口,您的浏览器都不会知道这一点。 80 and 443 seem to be standard in some way, so for example, if you changed 80 to 8080 , you'll have to access your websites this way then: 80443在某些方面似乎是标准的,例如,如果您将80更改为8080 ,那么您必须以这种方式访问​​您的网站:

localhost:8080/path_to_your_website.php

In my case this happened after installing sql server and the solution was as described in this answer就我而言,这是在安装 sql server 之后发生的,解决方案如本答案中所述

Xampp - Can't start Apache after install SQL Server and Visual Studio Xampp - 安装 SQL Server 和 Visual Studio 后无法启动 Apache

so I had to just disable "SQL Server Reporting Services" service from Windows services所以我只需要从 Windows 服务中禁用“SQL Server Reporting Services”服务

First of all you should verify that you have no excess virtual hosts in your httpd-vhosts file.首先,您应该确认您的 httpd-vhosts 文件中没有多余的虚拟主机。 I mean following simple rule: 1 project = 1 virtual host in config file.我的意思是遵循简单的规则:配置文件中的 1 个项目 = 1 个虚拟主机。 Otherwise you'll face with error even if you'll change ports etc.否则,即使您更改端口等,您也会面临错误。

I tried to execute httpd.exe in cmd and got error that there's syntax error in httpd-vhosts.conf.我试图在 cmd 中执行 httpd.exe 并得到错误,即 httpd-vhosts.conf 中存在语法错误。 I checked file and found what's wrong and it's working fine now.我检查了文件,发现出了什么问题,现在工作正常。

So, if you are facing this error then it may be because of httpd-vhosts or any other file.因此,如果您遇到此错误,则可能是因为 httpd-vhosts 或任何其他文件。

Try to execute the program via cmd and you will get the error details and the line where is syntax error.尝试通过 cmd 执行程序,您将获得错误详细信息以及语法错误所在的行。

Best of luck祝你好运

If all the answers above fail to work, Do this.如果上述所有答案均无效,请执行此操作。 comment out all the extensions in php.ini file.注释掉 php.ini 文件中的所有扩展名。

  1. In xampp control panel, click on Apache config.在 xampp 控制面板中,单击 Apache config。
  2. click on php.ini点击 php.ini
  3. In php ctrl + F (extension) to find all extensions in your php.ini在 php ctrl + F (extension) 中查找 php.ini 中的所有扩展
  4. Comment out each and every active extension by adding a ;通过添加一个 ; 来注释掉每个活动的扩展。 at the start of each extension line .在每条延长线的起点 example例子

    ;;;extension=bz2 ;;;扩展名=bz2

  5. i put 3 ;;;我把 3 ;;; because i wanted to know ones i commented out so that when i come back to deburg which one had a problem, it was easy for me to see which ones i commented out.因为我想知道我评论的那些,所以当我回到德堡时,哪个有问题,我很容易看到我评论了哪些。

  6. Make sure all extensions=whatever are commented out.确保所有 extensions=whatever 都被注释掉了。

  7. Run your apache server.运行你的 apache 服务器。

  8. To pickup which extension was the problem, one by one un-comment your extensions while restarting your server until you catch the culprit.要找出问题所在的扩展程序,请在重新启动服务器时一一取消注释您的扩展程序,直到找到罪魁祸首。

This worked for me and I wanted to share it这对我有用,我想分享它

If you have already created ssl for xampp by folowing the steps in this article如果您已经按照本文中的步骤为 xampp 创建了 ssl

open C:\xampp\apache\conf\extra\httpd-xampp.conf打开C:\xampp\apache\conf\extra\httpd-xampp.conf

check SSLCertificateFile "crt/site.test/server.crt"检查SSLCertificateFile "crt/site.test/server.crt"

if site.test in httpd-xampp.conf is different, then check C:\xampp\apache\crt\#YOUR_SITE_NAME_HERE\ .如果httpd-xampp.conf site.test的 site.test 不同,则检查C:\xampp\apache\crt\#YOUR_SITE_NAME_HERE\ change site.test in httpd-xampp.conf to #YOUR_SITE_NAME_HEREhttpd-xampp.conf site.test的 site.test 更改为#YOUR_SITE_NAME_HERE

Step 1: In Apache go to Config then select Apache(httpd.conf)第 1 步:在 Apache 中转到 Config,然后选择Apache(httpd.conf)

In the notepad, find Listen 80 and add another 80 to change the port to become Listen 8080在记事本中找到Listen 80 ,再添加一个80,将端口改为Listen 8080

Make sure to save before closing the notepad.确保在关闭记事本之前保存。

Step 2: In Apache go to Config the select Apache(httpd-ssl.conf)第 2 步:在 Apache 中转到 Config 选择Apache(httpd-ssl.conf)

In the notepad, find Listen 443 and add another 3 after 443 to change the port to become Listen 4433在记事本中找到Listen 443,在443后面再加3个,把端口改成Listen 4433

Then search for VirtualHost default :443 and add another 3 to change the port to become VirtualHost default :4433然后搜索VirtualHost default :443并添加另一个 3 以将端口更改为VirtualHost default :4433

Make sure to save before closing the notepad.确保在关闭记事本之前保存。

(Note: There is a similar answer here but it did not work for me until I fond a video on YT) (注意:这里有一个类似的答案,但在我喜欢 YT 上的视频之前它对我不起作用)

I received the same error above and what caused it for me was that in the file 'httpd-vhosts.conf' I put a comment inside the <Directory> tags like this...我在上面收到了同样的错误,对我来说是什么原因导致我在文件'httpd-vhosts.conf'中像这样在<Directory>标记中添加了评论......

<Directory "*PATH TO MY FOLDER*...">
        AllowOverride All
        Require all Granted    ## This directive could/should be set to denied.
</Directory>

Once I removed the comment, Apache started.一旦我删除了评论,Apache 就启动了。 I guess I should have put the comment on its own line.我想我应该把评论放在自己的行上。 I just thought, like other web code, it could be there.我只是想,就像其他网络代码一样,它可能在那里。

在 Windows 8.1 上从 5.6.8 安装最新的 5.6.12 对我有用。

Usually, xampp port error occurs because the default port 80 xampp trying to access is in use by another application.通常, xampp端口错误是因为xampp尝试访问的默认端口80正在被另一个应用程序使用。 Most of the times this application is Skype.大多数情况下,此应用程序是 Skype。
So, you have 2 methods to solve this problem:所以,你有两种方法来解决这个问题:

  1. Close or Terminate the process/application that is using the port.关闭或终止正在使用该端口的进程/应用程序。
  2. Use some other port for your xampp application.为您的 xampp 应用程序使用其他端口。 (I personally prefer this method). (我个人更喜欢这种方法)。

These methods are well explained in this post How to debug xampp port 80 error这些方法在这篇文章How to debug xampp port 80 error中有很好的解释

很可能您有另一个正在运行的“mysqld”进程将其杀死,然后重新运行 xampp MySQL,您不会收到任何错误。

In my case I edited the http.conf file for I wanted localhost to be accessible by other computers on the network and did not set a static IP on my network adapter.在我的情况下,我编辑了 http.conf 文件,因为我希望 localhost 可以被网络上的其他计算机访问,并且没有在我的网络适配器上设置静态 IP。 I also checked netstat and saw nobody was using port 80.我还检查了 netstat,发现没有人使用 80 端口。
So I opened cmd and typed所以我打开cmd并输入

ipconfig

I also opened the http.conf and searched(CTRL + F) for "Listen 80".我还打开了 http.conf 并搜索(CTRL + F)“Listen 80”。 The line above it, if not commented, enables localhost to be accessible over the network.它上面的行,如果没有注释,则可以通过网络访问 localhost。 It should look something like this:它应该看起来像这样:

Listen 192.168.93.3:80

Comparing the result from ipconfig command, I saw that my current ip address isn't the same as the one on the http.conf file.比较 ipconfig 命令的结果,我发现我当前的 ip 地址与 http.conf 文件中的不一样。 So I changed the ip address on the http.conf file with the one currently assigned to me and it worked.因此,我将 http.conf 文件中的 IP 地址更改为当前分配给我的 IP 地址,并且它起作用了。

Even i had this issue and i resolved it, in my case it was different.即使我遇到了这个问题并且我解决了它,在我的情况下它是不同的。

first i tried uninstalling the skype but that didn't work.首先我尝试卸载Skype,但没有奏效。 but in my windows 10 desktop, i had the IIS(Internet Information Server) installed by default which was pointing to port 80.但在我的 Windows 10 桌面上,我默认安装了指向 80 端口的 IIS(Internet 信息服务器)。

All i did is i changed the port number to 8081 and just restarted XAMPP, and that worked for me.我所做的只是将端口号更改为 8081,然后重新启动 XAMPP,这对我有用。

however i was not using IIS.但是我没有使用 IIS。

here is the link to https://support.microsoft.com/en-in/help/149605/how-to-change-the-tcp-port-for-iis-services这是指向https://support.microsoft.com/en-in/help/149605/how-to-change-the-tcp-port-for-iis-services的链接

I followed @user2314737 's advice (his answer is on page 1) and enabled "Show debug information" under "Config" that after a restart of xampp showed me that my install path had a space " " in it which wasn't allowed.我遵循@user2314737的建议(他的回答在第 1 页)并在“配置”下启用了“显示调试信息”,在重新启动 xampp 后显示我的安装路径中有一个空格“”,这是不允许的.

My path was D:\\Program files (x86)\\xampp\\ so I reinstalled it to D:\\xampp\\ and then it worked.我的路径是 D:\\Program files (x86)\\xampp\\ 所以我将它重新安装到 D:\\xampp\\ 然后它工作了。

Same error.同样的错误。 Turns out I had the wrong version of zend xdebug extension loaded.原来我加载了错误版本的 zend xdebug 扩展。 The xdebug wizard said to use the TS (Thread Safe) version (ie withOUT -NTS- ), but apparently I downloaded the incorrect NonThread Safe version. xdebug 向导说要使用 TS(线程安全)版本(即没有-NTS- ),但显然我下载了不正确的非线程安全版本。 Even though I had the path and file name accurate in the php.ini file, I was still getting the error.即使我在 php.ini 文件中的路径和文件名准确无误,我仍然收到错误消息。 When I downloaded the different version, and updated php.ini again, everything worked well.当我下载不同版本并再次更新 php.ini 时,一切正常。

php_xdebug-2.7.0-7.3-vc15-nts-x86_64.dll gave me an error, but no error with php_xdebug-2.7.0-7.3-vc15-x86_64.dll php_xdebug-2.7.0-7.3-vc15-nts-x86_64.dll给了我一个错误,但是php_xdebug-2.7.0-7.3-vc15-x86_64.dll没有错误

If changing the port didn't solve the problem as suggested above, and if you had probably played around with the file directory structure (for instance, change the name of the folder after installation like I did) then you can try this,如果按照上面的建议更改端口并没有解决问题,并且如果您可能玩过文件目录结构(例如,像我一样在安装后更改文件夹的名称),那么您可以试试这个,

  1. Open XAMPP Control Panel and click Apache's "Config"打开 XAMPP 控制面板并单击Apache 的“配置”
  2. Choose the Apache (httpd.conf)选择Apache (httpd.conf)
  3. In the editor that opened, press CTRL+H and find all instances of the old folder name and replace it with the new one.在打开的编辑器中,按 CTRL+H 并找到旧文件夹名称的所有实例并将其替换为新的。

For example, In my case, I had changed the main installation folder name of XAMPP from Xam to Xampp例如,就我而言,我已将 XAMPP 的主安装文件夹名称从Xam更改为Xampp

So in the editor change this:所以在编辑器中改变这个:

Define SRVROOT "G:/Xam/apache"
ServerRoot "G:/Xam/apache"
DocumentRoot "G:/Xam/htdocs"
<Directory "G:/Xam/htdocs">

To

Define SRVROOT "G:/Xampp/apache"
ServerRoot "G:/Xampp/apache"
DocumentRoot "G:/Xampps/htdocs"
<Directory "G:/Xampps/htdocs">

There are many other such instances in the editor, just find and replace each and every one of them.编辑器中还有很多其他这样的实例,只需找到并替换它们中的每一个即可。

Also do the same for, Apache (httpd-ssl.conf) .也对Apache (httpd-ssl.conf)做同样的事情。

You can go with the solutions mentioned above.您可以使用上述解决方案。 This issue can be resolved by making changes in your "httpd.conf"(C:\xampp\apache\conf\httpd.conf) file and "httpd-ssl.conf"(C:\xampp\apache\conf\extra\httpd-ssl.conf) file.此问题可以通过更改“httpd.conf”(C:\xampp\apache\conf\httpd.conf) 文件和“httpd-ssl.conf”(C:\xampp\apache\conf\extra\ httpd-ssl.conf) 文件。 If still the issue persists you can check with your skype port.如果问题仍然存在,您可以检查您的 Skype 端口。

But in my case this was different.但在我的情况下,这是不同的。 I had to make changes in "server.crt"(C:\xampp\apache\conf\ssl.crt\server.crt) file.Try running your xammp apache from the command line in administration mode.我必须在“server.crt”(C:\xampp\apache\conf\ssl.crt\server.crt)文件中进行更改。尝试在管理模式下从命令行运行 xammp apache。 "C:\xampp\apache\bin\httpd.exe" This will give you the errors -in which file and -which line. "C:\xampp\apache\bin\httpd.exe" 这会给你错误-in which file 和-which line。 Likewise, I had an error in server.crt file which was blank.同样,我在 server.crt 文件中有一个错误,它是空白的。 If you have xammp running in any other system, just copy the contents of this file(C:\xampp\apache\conf\ssl.crt\server.crt) and paste in your server.crt file and You are Done!如果您在任何其他系统中运行 xammp,只需复制此文件的内容(C:\xampp\apache\conf\ssl.crt\server.crt)并粘贴到您的 server.crt 文件中,您就完成了!

Thanks and Regards Archana感谢和问候阿卡纳

In my case it was much easier.就我而言,这要容易得多。 I turned off the native windows firewall.我关闭了本机 Windows 防火墙。 Then re-loaded comp launched xampp and started apache again.然后重新加载 comp 启动 xampp 并再次启动 apache。 Then turned the firewall on back.然后重新打开防火墙。

In my case, I got this problem coz Bitnami Wordpress was active.就我而言,我遇到了这个问题,因为 Bitnami Wordpress 处于活动状态。

  • Open the Bitanami App打开 Bitanami 应用程序
  • Go to Manage Servers转到Manage Servers
  • Make Sure to stop MySql and Apache确保停止MySqlApache
  • Restart xampp and it will work.重新启动xampp,它将工作。

Bitnami 管理服务器

Ok for my case it was really simple.好吧,就我而言,这真的很简单。

I set to a local IP address at my Ethernet port.我在我的以太网端口上设置了一个本地 IP 地址。

Then having this error.然后出现这个错误。 Turns out I did not connect the cable to it, so the IP does not resolve to the IP set in Apache.原来我没有将电缆连接到它,因此 IP 无法解析为 Apache 中设置的 IP。

Solution was to connect the cable to a switch or router.解决方案是将电缆连接到交换机或路由器。 Then able to start Apache.然后就可以启动Apache了。

Trick that works for me is,对我有用的技巧是,

Starting XAMPP as administrator以管理员身份启动 XAMPP

I tried changing ports using httpd.config and httpd-ssl.config.我尝试使用 httpd.config 和 httpd-ssl.config 更改端口。 It ended my saving it in .txt file.它结束了我将其保存在 .txt 文件中。 Also used config on the right top.还使用了右上角的配置。 None worked没有工作

I am using VMworkstation.我正在使用 VMworkstation。

我也遇到了同样的错误,我正在卸载 vmware 以修复该错误。

I tried all solutions but my problem persisted.我尝试了所有解决方案,但我的问题仍然存在。 It turns out after installing Visual Studio 2019, a lot of changes had occurred in my C++ Redistributables.事实证明,安装 Visual Studio 2019 后,我的 C++ Redistributables 发生了很多变化。

I actually run我真的跑

test_php.bat

which showed me the error which was这向我展示了错误

C:\Windows\SYSTEM32\VCRUNTIME140.dll' 14.0 is not compatible with this PHP build linked with 14.28 in Unknown on line 0 C:\Windows\SYSTEM32\VCRUNTIME140.dll' 14.0 与第 0 行未知中与 14.28 链接的此 PHP 版本不兼容

I therefore proceeded to the:因此,我进行了:

Microsoft Visual Studio website --> Other Tools, Frameworks, and Redistributables --> Microsoft Visual C++ Redistributable for Visual Studio 2019 Microsoft Visual Studio 网站 --> 其他工具、框架和可再发行组件 --> Microsoft Visual C++ Redistributable for Visual Studio 2019

and downloaded.并下载。 After installing the file and restarting my PC, problem solved.安装文件并重新启动我的电脑后,问题解决了。 Apache now runs without errors Apache 现在运行没有错误

After changing your port remember to change port in config.更改端口后,请记住在配置中更改端口。 It will simply run by "http://localhost:8081/phpmyadmin/" instead of http://localhost/phpmyadmin/它只会通过“http://localhost:8081/phpmyadmin/”而不是 http://localhost/phpmyadmin/ 运行

xampp

Follow this for instant solution!按照这个即时解决方案!

  1. This is coming either it doesn't have access to start a service to listen over PORT这即将到来,要么它无权启动服务以侦听 PORT

Soln: Use Admin Access Soln:使用管理员访问权限

  1. This is coming because already there is a port 80,443 is running on system这是因为系统上已经有一个端口 80,443 正在运行

Soln: use netstat -ano | find "0.0.0.0:443" Soln:使用netstat -ano | find "0.0.0.0:443" netstat -ano | find "0.0.0.0:443" and then use taskkill /pid ENTER_PROCESS_ID /F to kill and restart Apache netstat -ano | find "0.0.0.0:443"然后使用taskkill /pid ENTER_PROCESS_ID /F杀死并重新启动 Apache

  1. Search for backg services which are running and u don't need may be mongo, node server, etc close them搜索正在运行且您不需要的 backg 服务可能是 mongo、节点服务器等关闭它们

  2. If nothing works open httpd.conf and httpd-ssl.conf file and replace 443 as 4431 and 80 as 8080如果没有任何效果,请打开 httpd.conf 和 httpd-ssl.conf 文件并将 443 替换为 4431 并将 80 替换为 8080

  3. Nothing works may be due to problem related to files, so install XAMPP again in a location with no SPACE C:\XAMPP没有任何效果可能是由于与文件相关的问题,因此请在没有 SPACE C:\XAMPP

!!SOLVED!! !!解决了!!

I had a similar error and changing port or running as administrator didn't work.我遇到了类似的错误,更改端口或以管理员身份运行不起作用。 I'm on Windows 10. I ran apache_start.bat from xampp directory and I got a more specific feedback that said there was an error on my https-vhosts.conf file, specifically an extra \ at the end of a document root.我在 Windows 10 上。我从 xampp 目录运行 apache_start.bat,我得到了一个更具体的反馈,说我的 https-vhosts.conf 文件有错误,特别是在文档根目录的末尾有一个额外的 \。 Removed it, it worked again.删除它,它再次工作。

If you are using Skype, you will get this error.如果您使用的是 Skype,您将收到此错误。

Just press Ctrl+Alt+Del goto Task Manager select Skype and click End Task then go back and start the Apache once Apache starts successfully.只需按 Ctrl+Alt+Del 转到任务管理器,选择 Skype 并单击结束任务,然后在 Apache 成功启动后返回并启动Apache Then open the Skype again now both will work well.然后再次打开 Skype,现在两者都可以正常工作。

Not necessary to change any port.无需更改任何端口。

The solution is uninstall the xampp and reinstall it.解决方案是卸载 xampp 并重新安装。 it will be work这将是工作

对我来说,这就像更新 Windows 并重新启动一样简单。

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

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