Apache无法启动 - ServerRoot必须是有效的目录,并且无法找到指定的模块

Bac*_*ash 31 apache httpd.conf

我正在使用xampp便携式服务器而我在Apache http服务器上遇到了一些问题,它说"ServerRoot必须是一个有效的目录"

命令行输出:

Please close this command only for Shutdown
Apache 2 is starting ...
httpd.exe: Syntax error on line 35 of K:/../../../xampp/apache/conf/httpd.conf: ServerRoot must be a valid directory

Apache could not be started
Run Code Online (Sandbox Code Playgroud)

我检查了xampp/apache/conf/httpd.conf的第35行,它是:

ServerRoot "/xampp/apache"
Run Code Online (Sandbox Code Playgroud)

哪个不存在.我的文件夹是:

K:/../../../xampp/apache/conf     <- where the httpd.conf is
K:/../../../xampp/apache/         <- the server root
K:/../../../xampp/apache/modules  <- where server modules are
Run Code Online (Sandbox Code Playgroud)

如果我改变(在第35行)

ServerRoot ".."
Run Code Online (Sandbox Code Playgroud)

它说:

Please close this command only for Shutdown
Apache 2 is starting ...
httpd.exe: Syntax error on line 65 of K:/../../../xampp/apache/conf/httpd.conf: Cannot load modules/mod_access_compat.so into server: Unable to find the specified module

Apache could not be started
Run Code Online (Sandbox Code Playgroud)

我检查过,modules/mod_access_compat.so存在,所以我无法弄清楚如何修复它.

任何帮助将不胜感激

小智 53

只需从shell运行setup_xampp.bat(来自XAMPP控制面板的shell),并且应该为XAMPP for Windows的可移植版本自动设置路径.它对我有用.

  • “它说抱歉,但无能为力” (3认同)
  • 当您在自定义目录(而不是c:/ xampp ...)中安装xampp时,这尤其有用 (2认同)

Gur*_*uru 23

导航到Apache24中的conf direcotry中的httpd.conf文件或您拥有的任何apache文件.

转到ServerRoot =".."行并将值更改为apache所在的路径,如"C:\ Program Files\Apache24"