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:
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
I checked the line 35 of xampp/apache/conf/httpd.conf and it was:
ServerRoot "/xampp/apache"
Which doesn't exist. My folders are:
K:/../../../xampp/apache/conf <- where the httpd.conf is
K:/../../../xampp/apache/ <- the server root
K:/../../../xampp/apache/modules <- where server modules are
If i change (at line 35) to
ServerRoot ".."
It says:
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
I checked, and modules/mod_access_compat.so exists, so i can't figure out how to fix it.
Any help will be appreciated
This question is related to
apache
httpd.conf
Use the drive letter with forward slashes to get started (c:/apache/...).
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\"
I had this exact same problem with Xampp portable on Windows 10 Home. I went through all the suggestions and none worked. I did get it working with Windows Firewall Settings and an error on my part.
My pen drive was labelled Drive E on my laptop and Drive F on my Desktop. Once I corrected that using disk partition and changed the drive letter to E for my desktop to windows asked for access for the firewall and everything clicked.
The steps to correct the drive letter were: 1. Hit the windows key and type Partition, "create and format harddisks partitions" should be at the top, hit enter 2. Find the drive you are looking for at the top panel and click on it. 3. Right click on it and select change drive letter and path, click okay 4. Now try to start xampp control panel and start Apache and Mysql 5. if you get the windows firewall click allow.
I can't say this will work but it did for me and is what I added to this discussion. I also think it might have been just the firewall did not allow the oither drive letter.
Make sure your ServerRoot
in httpd.conf points correctly to the Apache path. Otherwise you will see this message for every further module.
Examples:
/etc/apache2/apache2
for Linux"C:\Program Files\Apache24"
for WindowsIf 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
I would think that ServerRoot needs to be absolute. Use something like "/apache/docroot"
If you use an actuall version there is a "setup_xampp.bat/.sh" script in the root directory. The path has to be absolute but the script changes all needed paths to your current location.
Below solved. I have wrongly given the bin /directory/, so faced the issue:
if you installed apache at C:/httpd-2.4.41-o102s-x64-vc14-r2/Apache24
then the modules are at.. C:/httpd-2.4.41-o102s-x64-vc14-r2/Apache24/modules
So, the file C:/httpd-2.4.41-o102s-x64-vc14-r2/Apache24/conf/httpd.conf
should have
Define SRVROOT "C:/httpd-2.4.41-o102s-x64-vc14-r2/Apache24/"
Hope that helps
Change below path in httpd.conf file to your setup. This will fix the issue.
Define SRVROOT "C:\Apache24"
ServerRoot "${SRVROOT}"
ServerRoot "xampp\apache"
ServerRoot "D:\Hacking Tools 2\Programs\XAMPP V2\apache"
ServerRoot "D:\XAMPP\apache"
It worked for me, if it doesn't work for you, just comment with the error value after opening the xampp_start.exe
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"
I checked the line 35 of xampp/apache/conf/httpd.conf and it was:
ServerRoot "/xampp/apache"
Which doesn't exist. ...
Create the directory, or change the path to the directory that contains your hypertext documents.
Source: Stackoverflow.com