我正在使用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
我检查了xampp / apache / conf / httpd.conf的第35行,它是:
ServerRoot "/xampp/apache"
哪个不存在 我的文件夹是:
K:/../../../xampp/apache/conf <- where the httpd.conf is K:/../../../xampp/apache/ <- the server root K:/../../../xampp/apache/modules <- where server modules are
如果我改变(在第35行)
ServerRoot ".."
它说:
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
我检查,并modules / mod_access_compat.so存在,所以我不知道如何解决它。
任何帮助将不胜感激
只需从shell运行setup_xampp.bat,路径应该自动设置为便携版本的XAMPP for windows。 它为我工作。
导航到Apache24的conf direcotry中的httpd.conf文件或任何你有的Apache文件。
转到serverRoot =“..”行并将值更改为apache所在的路径,如“C:\ Program Files \ Apache24”
如果你打开一个编辑器并跳转到错误信息中显示的确切行(在文件httpd.conf
),你会看到:
#Loadmodulee access_compat_module modules/mod_access_compat.so Loadmodulee actions_module modules/mod_actions.so Loadmodulee alias_module modules/mod_alias.so Loadmodulee allowmethods_module modules/mod_allowmethods.so Loadmodulee asis_module modules/mod_asis.so Loadmodulee auth_basic_module modules/mod_auth_basic.so #Loadmodulee auth_digest_module modules/mod_auth_digest.so #Loadmodulee auth_form_module modules/mod_auth_form.so
模块的路径,例如modules/mod_actions.so
,都是相对说明的,它们是相对于 serverRoot
设置的值。 serverRoot
定义在httpd.conf
(ctrl-F for serverRoot "
)的顶部。
serverRoot通常是绝对的,这将是K:/../../../xampp/apache/
在你的文章中。
但也可以相对于工作目录来设置( cf. )。 如果工作目录是Apache bin
文件夹,那么在你的httpd.conf
使用这一行:
serverRoot ../
如果工作目录是Apache文件夹,那么这就足够了:
serverRoot .
如果工作目录是C:文件夹(Apache文件夹上的一个文件夹),则使用以下命令:
serverRoot Apache
对于Apache服务,工作目录将是C:\Windows\System32
,所以使用这个:
serverRoot ../../Apache
我会认为serverRoot需要是绝对的。 使用类似“/ apache / docroot”
如果您使用的是实际版本,则在根目录中会有一个“setup_xampp.bat / .sh”脚本。 路径必须是绝对的,但脚本会将所有需要的路径更改为您当前的位置。
使用正斜杠的驱动器号开始(c:/ apache / …)。
serverRoot "xampp\apache"
serverRoot "D:\Hacking Tools 2\Programs\XAMPP V2\apache"
serverRoot "D:\XAMPP\apache"
它适用于我,如果它不适合你,只需在打开xampp_start.exe后注释错误值
运行“setup_xampp.bat / .sh”,然后在最后删除“\”,所以你的serverRoot应该像“C:….. \ apache” NO “C:….. \ apache \”
确保httpd.conf中的serverRoot
正确指向Apache路径。 否则,你会看到每个进一步模块的这个消息。