我刚刚重新安装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服务器默认运行在80、443端口上。您的问题是两个端口中的一个或两个都忙。通常Skype或VMware Workstation使用这两个端口。所以,确保它们没有在运行。确保端口在windows上是空闲的最好方法是:

单击“窗口”按钮。 在搜索栏中输入resmon,打开资源监视器resmon.exe。 Open Listening Ports,这将显示打开的已使用端口。 现在您可以看到哪个进程正在使用端口80和443。 然后,您可以从CMD中使用进程的PID(在资源监视器中显示)终止进程,或者直接从任务管理器中终止进程。 使用PID类型Taskkill /PID 26356 /F从CMD中终止进程,其中26356是PID。

其他回答

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

遵循以下步骤:

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。

有时问题不是端口问题,但可能是由于您所做的错误配置,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

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

即使我也有这个问题,我解决了,在我的情况下,它是不同的。

首先,我尝试卸载skype,但没有工作。但是在我的windows 10桌面中,我默认安装了IIS(Internet Information Server),指向80端口。

我所做的就是将端口号更改为8081,并重新启动XAMPP,这对我来说很有效。

但是我没有使用IIS。

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

首先,您应该验证httpd-vhosts文件中没有多余的虚拟主机。我的意思是遵循简单的规则:在配置文件中,1个项目= 1个虚拟主机。否则,即使您更改端口等,也会面临错误。