首页 > 解决方案 > 可以通过命令行启动 Apache,但不能通过 Wamp Server

问题描述

我在 Windows 10 上运行 wampserver 3.1.4。它可以启动 php 和 MySql,但不会启动 Apache。我可以从命令行运行 httpd.exe 并且它启动没有问题。

EventViewer 告诉我在 DocumentRoot 行上的 vhosts 文件中有语法错误,但我检查了路径并且一切都正确,并且它从 CLI 启动正常。

似乎是 wampapache64 在某处配置错误。

这是我的 httpd-vhosts.conf 文件

语法错误发生在第二个块中的“DocumentRoot”行。如果我删除第二个块它工作正常。文件夹路径正确

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName local.shiftlegal.co.nz
    DocumentRoot "c:/projects/true/shift/shiftlegal.co.nz"
    <Directory  "c:/projects/true/shift/shiftlegal.co.nz/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

我还应该注意到,这个确切的配置在几天前就开始工作了。

每次尝试运行 wamp 时,我都会在 Windows EventViewer 中收到 2 条错误消息:

The Apache service named  reported the following error:
>>> AH00526: Syntax error on line 16 of C:/wamp64/bin/apache/apache2.4.35/conf/extra/httpd-vhosts.conf:     .

The Apache service named  reported the following error:
>>> DocumentRoot must be a directory     .

标签: apachewampserver

解决方案


出色地。

我不确定发生了什么,但事实证明它与 wampserver 没有太大关系。

看来我的项目文件夹以某种方式损坏了。我创建了一个新文件夹并添加了一个项目并且它有效。

感谢@RiggsFolly 的所有帮助。


推荐阅读