我的机器上安装了 XAMPP。我正在尝试从 XAMPP 控制面板运行 Apache。
我通过右键单击快捷方式并选择“以管理员身份运行”(我使用具有管理员权限的帐户登录)来启动 XAMPP 控制面板。控制面板启动,一切似乎都按顺序进行(没有错误消息/警告)。
当我单击 Apache 旁边的开始按钮时,我收到以下错误消息:
2:22:44 PM [Apache] Attempting to start Apache app...
2:22:45 PM [Apache] Status change detected: running
2:22:45 PM [Apache] Status change detected: stopped
2:22:45 PM [Apache] Error: Apache shutdown unexpectedly.
2:22:45 PM [Apache] This may be due to a blocked port, missing dependencies,
2:22:45 PM [Apache] improper privileges, a crash, or a shutdown by another method.
2:22:45 PM [Apache] Check the "/xampp/apache/logs/error.log" file
2:22:45 PM [Apache] and the Windows Event Viewer for more clues
请注意,它告诉我 Apache 意外关闭并检查 error.log 文件和 Windows 事件查看器。
我检查了 error.log 文件,但它是空的:
我还使用 Windows 事件查看器检查了任何事件,但事件查看器未显示任何事件(在“应用程序”下):
我已检查了可能阻塞端口等的程序(例如 Skype、Visual SVN Server),并关闭了所有可能导致问题的程序。
我还能做些什么来找出可能发生的情况吗?
谢谢。
更新
我通过尝试从 DOS 命令提示符运行 apache 解决了这个问题。从命令提示符运行会给出具体的错误以及这些错误在 httpd.conf 文件中的位置。事实证明,我的 ServerRoot 和 DocumentRoot 值不正确(指向错误的目录)。我将它们更改为指向正确的目录,现在我可以从控制面板启动 apache。
奇怪,为什么我在从控制面板启动时没有看到有关 ServerRoot 和 DocumentRoot 的错误消息?
最佳答案
只是想提一下,我还使用了命令提示符技术。
我的问题:我重新启动了 Apache,但无法让程序再次启动。
解决方案尝试 1:这不起作用。 我没有像 SKYPE 这样的程序占用端口,但我还是尝试调整我的端口设置。
解决方案尝试 2:这不起作用。 我读过的另一个解决方案是在 Windows 防火墙中允许公共(public)访问或禁用防火墙。我尝试过这个。
解决方案尝试 3:这确实有效 最后我偶然发现了这篇文章。我打开了 gitbash (尽管默认的 Windows 命令提示符可以正常工作)。
我输入了“cd c:/xampp/apache/bin” 然后我输入“httpd”
这给我带来了语法错误,并指向我的“httpd-vhosts”文件中的特定行。我发现该行出了什么问题,在我的例子中缺少“#”。保存文件,然后再次输入“httpd”。这次apache服务器启动了。
希望这对一些人有帮助!
关于apache - Xampp - Apache 意外关闭,日志文件为空且无事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21102707/