apache - 可以通过命令行启动 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 .
解决方案
出色地。
我不确定发生了什么,但事实证明它与 wampserver 没有太大关系。
看来我的项目文件夹以某种方式损坏了。我创建了一个新文件夹并添加了一个项目并且它有效。
感谢@RiggsFolly 的所有帮助。
推荐阅读
- python - 我是否获得了 tf.nn.depthwise_conv2d() 的正确输出?
- github - 如何在不翻阅数百页提交的情况下查看 github.com 存储库上的初始提交集?
- azure-data-explorer - 将搜索 * 运算符与“数据库”功能结合使用
- c# - 随机重命名文件方法
- python - 从项目列表中创建特定形状的熊猫数据框
- python - 如何使用 Python 中的 ascii 翻译将十六进制值转换为整数?
- android-studio - 按钮在 Android Studio 3.4 的布局编辑器中不可见
- javascript - 如何使canvas html中的区域可放置?
- regex - 在模式中查找逗号
- java - String.format() 作为常量表达式