电脑是Windows系统,在本地安装Apache服务器,在启动时提示语法错误:
Errors reported here must be corrected before the service can be started
httpd.exe: Syntax error on line 39 of D:/Apache24/conf/httpd.conf: ServerRoot must be a valid directory
大至意思是Apache配置文件httpd.conf的第39行有语法错误,找到该文件的39行是
ServerRoot "${SRVROOT}"
这句定义服务器根目录,搜索SRVROOT找到
Define SRVROOT "C:/Apache24"
默认路径是在C盘,从上面的报错可以知道Apache安装在D盘,所以要修改根目录路径为实际的安装目录,所以将其修改为:
Define SRVROOT "D:/Apache24"
保存后,重启Apache服务器
cd D:\Apache24\bin httpd.exe -k restart
提示:如果已经进入到bin目录,则执行
.\httpd.exe -k restart
启动成功,问题解决!