Saturday, April 9, 2022

[SOLVED] Apache could not be started - ServerRoot must be a valid directory and Unable to find the specified module

Issue

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


Solution

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.



Answered By - Bostjan
Answer Checked By - Dawn Plyler (WPSolving Volunteer)