我刚刚重新安装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

我怎么解决这个问题?


当前回答

有时问题不是端口问题,但可能是由于您所做的错误配置,Apache没有在Windows的事件查看器中记录错误。简单地说

cd C:\xampp\apache\bin

然后运行

httpd.exe

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

我希望这能帮助一些可怜的人:)

其他回答

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. I also checked netstat and saw nobody was using port 80. So I opened cmd and typed ipconfig I also opened the http.conf and searched(CTRL + F) for "Listen 80". The line above it, if not commented, enables localhost to be accessible over the network. 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. So I changed the ip address on the http.conf file with the one currently assigned to me and it worked.

遵循以下步骤:

Open your XAMPP control panel then click its "Config" Choose the "Apache (httpd.conf)" and find this code below and change it into this one: #Change this to Listen on specific IP addresses as shown below #to prevent Apache from glomming onto all bound IP addresses. #Listen 0.0.0.0:80 #Listen [::]:80 Listen 80 # Dynamic Shared Object (DSO) Support Save it (Ctrl + S) After that, go back to the XAMPP control panel and click its config again. Choose "Apache (httpd-ssl.conf)", find this code below, and change it again: # Note: Configurations that use IPv6 but not IPv4-mapped addresses need two # Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443" # #Listen 0.0.0.0:443 #Listen [::]:443 Listen 443 Save it (Ctrl + S) Then, click the "config" (note: above the netstat) and click the "service and port settings". Change "Main Port" to 8080 and "SSL Port" to 4433, then save it. Finally, go to the "control panel" -> "Programs & Features" -> "Turn Windows On or Off". Uncheck your "Internet Information Services", and then click OK.

只需等待它,您的计算机/笔记本电脑将自动重新启动,并尝试再次打开XAMPP控制面板,然后启动Apache。

您可以做的一件事是通过发出命令停止端口80上的服务

net stop http

在cmd中。系统将询问您是否确定要停止这些服务。我发现我有一些服务我没有使用,并关闭了它们。

要查看还有谁正在使用端口80,请键入cmd

netstat -abno

我假设您希望在端口80上运行Apache。如果是这种情况,并且希望保留冲突的服务,则需要将它们关联到一个新的端口。

如果问题不是端口繁忙,您也可以尝试以下方法:在XAMPP配置面板中选择“显示调试信息”。当启动Apache时,会显示类似“正在执行”c:\xampp\ Apache \bin\httpd.exe”的内容。如果你运行它

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

在cmd中,你会得到更多的信息(我曾经有一些问题与我的httpd.conf文件)。

相关:如何释放我的端口80在本地主机Windows?Apache不能在xampp中运行

通常,xampp端口错误发生是因为另一个应用程序正在使用xampp试图访问的默认端口80。大多数时候这个应用程序就是Skype。 所以,你有两种方法来解决这个问题:

关闭或终止正在使用该端口的进程/应用程序。 为xampp应用程序使用其他端口。(我个人更喜欢这种方法)。

这些方法在这篇文章中很好地解释了如何调试xampp端口80错误

如果你正在使用Skype,你会得到这个错误。

只需按Ctrl+Alt+Del goto任务管理器选择Skype,然后单击结束任务,然后返回并启动Apache,一旦Apache启动成功。然后再打开Skype现在都将工作良好。

无需更改任何端口。