I\'m using xampp portable server and I\'m having some trouble with Apache http server, it says \"ServerRoot must be a valid directory\"
Command line output:
Just run setup_xampp.bat from shell (shell from XAMPP control panel)and the paths should be set automatically for the portable version of XAMPP for windows. It has worked for me.
Change below path in httpd.conf file to your setup. This will fix the issue.
Define SRVROOT "C:\Apache24"
ServerRoot "${SRVROOT}"
That for changing directory of the XAMPP. So you have to change the Directory as well as ServerRoot "E:/xampp/apache"
DocumentRoot "E:/xampp/htdocs"
<Directory "E:/xampp/htdocs">
ScriptAlias /cgi-bin/ "E:/xampp/cgi-bin/"
<Directory "E:/xampp/cgi-bin">
AllowOverride All
Options None
Require all granted
</Directory>
I also facing same problem for changing My laptop. thanks
Run "setup_xampp.bat/.sh" and then Delete "\" at the end, so your ServerRoot should be like "C:.....\apache" NO "C:.....\apache\"
If you open an editor and jump to the exact line shown in the error message (within the file httpd.conf
), this is what you'd see:
#LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule auth_form_module modules/mod_auth_form.so
The paths to the modules, e.g. modules/mod_actions.so
, are all stated relatively, and they are relative to the value set by ServerRoot
. ServerRoot
is defined at the top of httpd.conf
(ctrl-F for ServerRoot "
).
ServerRoot is usually set absolutely, which would be K:/../../../xampp/apache/
in your post.
But it can also be set relatively, relative to the working directory (cf.). If the working directory is the Apache bin
folder, then use this line in your httpd.conf
:
ServerRoot ../
If the working directory is the Apache folder, then this would suffice:
ServerRoot .
If the working directory is the C: folder (one folder above the Apache folder), then use this:
ServerRoot Apache
For apache services, the working directory would be C:\Windows\System32, so use this:
ServerRoot ../../Apache
navigate to httpd.conf file in conf direcotry in Apache24 or whatever apache file you have.
Go to ServerRoot= ".." line and change the value to the path where apache is located like "C:\Program Files\Apache24"