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

我怎么解决这个问题?


当前回答

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

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

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

其他回答

我遇到了同样的问题,结果是我忘记运行setup_xampp.bat(可移植版本)。

对我来说,万维网发布服务使用的是80端口。我通过在cmd上运行以下命令来杀死它:

net stop http

在那之后,XAMPP运行Apache没有任何问题。

我收到了上面相同的错误,导致我的原因是在文件'httpd-vhosts.conf'中,我在<Directory>标签中放了一个注释,就像这样…

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

一旦我删除了注释,Apache就启动了。我想我应该把注释放在它自己的行里。我只是想,像其他网络代码一样,它可以在那里。

好吧,没有端口80,没有Skype的指责!我的问题确实很简单(也很愚蠢), 在我为DocumentRoot指令指定的路径之后,我有一个额外的反斜杠(\)(在Windows上),所以我做了这样的更改,问题就像鸭汤一样消失了。

我的index.php在路径“D:\ sites\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>

所以就像这样改变这两行:

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

...现在一切都好了。为了防止将来发生这样的错误,总是复制任何你想要引用的文件夹的路径,而不是自己输入。

注意,无论何时更改默认端口,浏览器都不会知道。80和443似乎在某种程度上是标准的,例如,如果您将80更改为8080,那么您将不得不以这种方式访问您的网站:

localhost: 8080 / path_to_your_website.php