WAMP的apache无法启动DocumentRoot must be a directory

时间:2023-01-20 16:03:52

WAMP的apache无法启动DocumentRoot must be a directory

自己电脑上之前带的装的wamp好久没用了,今天用的时候发现启动不起来。之前刚安装时也遇到过无法启动,图标一直是橙色,当时是因为电脑上原来安装的IIS和Mysql占用了相应端口,这次查看了并没有其他程序占用端口。废话好多。

打开cmd,切换到有httpd.exe的目录下,我的是D:\wwy\wamp\bin\apache\apache2.4.9\bin,输入httpd,如下图

D:\wwy\wamp\bin\apache\apache2.4.9\bin>httpd
AH00526: Syntax error on line 230 of D:/wwy/wamp/bin/apache/apache2.4.9/conf/htt
pd.conf:
DocumentRoot must be a directory

配置文件230行语法错误 ,文件根目录必须为目录(有点绕口),找到配置文件的这一行
如下最后一行,配置是正确的,突然想起上次干完活把那个文件夹删了,加上就好了

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#DocumentRoot "D:/wwy/wamp/www/jsj.xidian.edu.cn/"
DocumentRoot "D:\wwy\wamp\www"

有人说斜杠与反斜杠的不同会也会造成这种情况,因为linux下用的是/,windows用\,但是我测验了一下,win7用/也是可以的。