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

我怎么解决这个问题?


当前回答

我的问题是在httpd.conf中的DocumentRoot和<Directory>条目指向不存在的文件夹。

例如,'原始' httpd.conf有以下条目:

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

如果您已经安装在C:\xampp中,那么您需要更改这些条目以匹配。

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

其他回答

您可以做的一件事是通过发出命令停止端口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中运行

我也有同样的问题(在Windows 8.1上),但我只是通过提取到C:\而不是C:\somefolder来解决它,就像我一开始做的那样。例如,控制面板的路径现在是C:\xampp\xampp-control.exe

我的问题是在httpd.conf中的DocumentRoot和<Directory>条目指向不存在的文件夹。

例如,'原始' httpd.conf有以下条目:

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

如果您已经安装在C:\xampp中,那么您需要更改这些条目以匹配。

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

如果你用的是Windows 7。在Windows搜索中搜索IIS(单击左下角的窗口图标,并键入“搜索程序和文件”)。

打开IIS (Internet信息服务)。

在右侧的操作面板。单击停止。

注意:停止链接在屏幕截图中是褪色的。就像我阻止了它一样。 问题解决了!

如果上面所有的答案都不奏效,那么就这么做。注释掉php.ini文件中的所有扩展名。

In xampp control panel, click on Apache config. click on php.ini In php ctrl + F (extension) to find all extensions in your php.ini Comment out each and every active extension by adding a ; at the start of each extension line. example ;;;extension=bz2 i put 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. Make sure all extensions=whatever are commented out. Run your apache server. To pickup which extension was the problem, one by one un-comment your extensions while restarting your server until you catch the culprit.