ServerRoot Relative, DocumentRoot Relativity Problem

Problems with the Windows version of XAMPP, questions, comments, and anything related.

ServerRoot Relative, DocumentRoot Relativity Problem

Postby goodeit » 09. December 2011 03:44

Hello,
I am having some trouble getting ServerRoot and DocumentRoot relative directories set correctly. My goal is to have both be relative directories, so I could launch apache from any directory and not have to worry about where it was located. However I am getting strange behavior with my DocumentRoot. ServerRoot works fine, but DocumentRoot seems to assume that ServerRoot is relative to C:\xampp, even if apache is being launched from C:\Users\Me\Desktop\xampp.

All locations point to folders in the standard XAMPP directory structure.

Here are my current settings:
Code: Select all
ServerRoot "apache"      # relative path to C:\Users\Me\Desktop\xampp\apache
DocumentRoot "../htdocs"


Here's the output of trying to launch apache:
Code: Select all
C:\Users\Me\Desktop\xampp>apache\bin\httpd.exe
Warning: DocumentRoot [C:/xampp/htdocs] does not exist


I believe the DocumentRoot should be displaying C:\Users\Me\Desktop\xampp\htdocs. No matter what I change, it seems to end up referencing C:\xampp. I did a global search and couldn't find where that was being referenced. As a secondary problem, DocumentRoot seems to be very picky in what it accepts (e.g. I get an error trying "htdocs" in the example above). Does anyone have any insight into what could be causing these issues?

I'm running XAMPP Lite 1.7.7 on Windows 7 x86.
Thanks!
Last edited by goodeit on 09. December 2011 03:48, edited 1 time in total.
goodeit
 
Posts: 8
Joined: 09. December 2011 02:47
Operating System: Windows 7

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 03:48

What does DocumentRoot refer to in the xampp\apache\conf\httpd.conf file?
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby goodeit » 09. December 2011 03:49

Thanks for your fast reply! DocumentRoot refers to "../htdocs"
goodeit
 
Posts: 8
Joined: 09. December 2011 02:47
Operating System: Windows 7

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 04:05

...and the ServerRoot and also the <Directory> directive (DocumentRoot and <Directory> should be the same).

In the default httpd.conf file these point to:
ServerRoot "/xampp/apache"
DocumentRoot "/xampp/htdocs"
<Directory "/xampp/htdocs">
EDIT - xampplite was from older lite versions.

I will comment further when I see the whole path picture but as a quickie the relative path ../htdocs is incorrect for your structure as it assuming the htdocs folder is one folder up from apache (httpd.exe) which it is clearly not.

Not even sure if you can use a relative path as mostly an absolute path is used as in the default settings - /xampp/htdocs may be the answer.

Also the \xampp\apache\logs\error.log file may hold more info on this issue.

All the XAMPP installation instructions refer to installing to the root of a drive or partition which overcomes most installation and configuration issues.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 04:41

To try and reproduce your problem then I did the following.

I created a folder structure the same as you have and extracted the 1.7.7 lite version in the final desktop folder and without changing any configurations the control panel started and stopped Apache and MySQL as did the apache_start.bat file as did the xampp_start.exe and from a command console window typing httpd.exe in the apache bin folder also did it's job.

There was no problem 1.7.7 lite worked 'out of the box' no matter where I extracted it to.

If you did not do a portable storage installation and ran the setup_xampp.bat file then it will not be portable and the paths are then hard coded into the configuration files by the bat file and would reflect the folder tree you mentioned in your first post.


BTW if you used IZArc freeware to extract the files then there is a known bug that it does not extract all the files from the archive, it does not extract zero length files which are needed in XAMPP.
So use a zip extracting utility like WinRar or WinZip (not tested) or 7zip etc.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby goodeit » 09. December 2011 04:59

While reviewing my reply, I saw that you posted again. I'll leave the old reply below for posterity.

I just did a fresh unzip into .../Desktop/xampporig and I could not use apache_start.bat(/.exe) or httpd.exe or the control panel . Not sure what the difference is, but I get the same error each time:
Code: Select all
httpd.exe: Syntax error on line 35 of C:/Users/Me/Desktop/xampporig/apache/co
nf/httpd.conf: ServerRoot must be a valid directory


I did not do any kind of installation or run any kind of setup.bat file... is that something I need to do?

I am not using 7-zip so hopefully that is not the issue.

Thanks for taking the time to help me!

----

ServerRoot and DocumentRoot were both listed in my original post. ServerRoot is "apache". My <directory> is also set to "../htdocs".

The relative path "../htdocs" would seem to be incorrect (apache is in xampp/apache/bin and htdocs is xampp/htdocs, so it should be "../../htdocs"), but apache throws an error if I try and change it to that or other things, including "htdocs". The error is: Syntax error on line 183 of C:/Users/Tommy/Desktop/xampp/apache/conf/httpd.conf:

DocumentRoot must be a directory


Adding a trailing / does not help the error. It seems to be giving some pretty crazy behavior. Either way it should accept any directory,and just warn if the directory doesn't exist.

I know installing to the root of a drive would be easiest, but that's the exact thing I'm trying to avoid :(
goodeit
 
Posts: 8
Joined: 09. December 2011 02:47
Operating System: Windows 7

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 05:16

No need to run the setup_xampp.bat file as in my example it was not used.

There is no need to install to a drive root as I explained, it will work just about anywhere as long as there are no spaces in the folder names or special characters like brackets etc.

I have G:\user\me\desktop\xampp
xampp is the folder with all the xampp files and folders and as I pointed out using all the start and stop methods included in the xampp release then there was no errors.

Line 183 in the default installation should be:
DocumentRoot "/xampp/htdocs"

Open your httpd.conf file in an editor and make sure that all the paths mentioned in my posts above are indeed
/xampp/htdocs
or
/xampp/apache
They are the defaults.

Only use the Control Panel xampp-control.exe found in the xampp folder to control all the XAMPP included components.
Try right clicking on the xampp-control.exe file and select to run as an admin.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 05:30

When you open the zip file you see a folder xampp then drag that folder to the location of choice as if you rename that folder to xampporig then you will have to rename all the paths in every configuration file - so best left as xampp.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby goodeit » 09. December 2011 05:50

I deleted all files, re-did the unzip, and left it in the xampp folder and am receiving the same error. Double-checked httpd.conf and my values are consistent. I don't have any stray environmental variables set or anything else I can think of that could be doing this.

I'm going to try downloading a different package (current one is xampp-win32-1.7.7-usb-lite.7z) and see if that does anything.
goodeit
 
Posts: 8
Joined: 09. December 2011 02:47
Operating System: Windows 7

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby goodeit » 09. December 2011 07:01

Tried with the .zip version and am getting the same thing.
goodeit
 
Posts: 8
Joined: 09. December 2011 02:47
Operating System: Windows 7

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 07:08

Open the \xampp\apache\conf\httpd.conf file and paste here these 3 lines:
1. ServerRoot (About line 35)
2. DocumentRoot (About line 183)
3. <Directory> (About line 210)

Paste here the \xampp\apache\logs\error.log file from your last attempt to start Apache.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby goodeit » 09. December 2011 16:25

ServerRoot "/xampp/apache"
DocumentRoot "/xampp/htdocs"
<Directory "/xampp/htdocs">

There is no error.log file created when attempting to start Apache from the control panel (launching apache fails before it begins logging, I think).
The error I get when launching apache through the command line is
Code: Select all
httpd.exe: Syntax error on line 35 of C:/Users/Me/Desktop/xampp/apache/conf/h
ttpd.conf: ServerRoot must be a valid directory


furthermore, when trying to start mysql using start_mysql.bat, I noticed an error that referenced C:\xampp:
Code: Select all
...
MySQL is trying to start
Please wait  ...
MySQL is starting with mysql\bin\my.ini (console)
111209 10:24:06 [ERROR] Can't find messagefile 'C:\xampp\mysql\share\errmsg.sys'

111209 10:24:07 [Warning] Can't create test file \xampp\mysql\data\MyLaptop.l
ower-test
111209 10:24:07 [Warning] Can't create test file \xampp\mysql\data\MyLaptop.l
ower-test
mysql\bin\mysqld: Can't change dir to '\xampp\mysql\data\' (Errcode: 2)
111209 10:24:07 [ERROR] Aborting
...
goodeit
 
Posts: 8
Joined: 09. December 2011 02:47
Operating System: Windows 7

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 22:44

If Apache has never started and there are no log files then you may be missing the VC9 runtime file as 1.7.7 is compiled using this method.
Please download and install the VC9 runtime file from Microsoft:
http://www.microsoft.com/download/en/de ... px?id=5582

Follow the install instructions and after a successful install try and start Apache and MySQL from the Control Panel.

Usually if it is not possible to start the components from the control panel then it may also not be possible from a command console.

I am also beginning to wonder if your issue is related to Win 7 in some way as you are using the user's desktop which may have some permissions issues - I can't test it on Win 7 but on XP 1.7.7 lite setup without the setup_xampp.bat file works flawlessly.

By way of a test and if you are not installing on a USB or other portable device then after downloading and installing the runtime file it does not fix the Apache start issues with the CP, then run the setup_xampp.bat file and see if that allows you to start Apache and MySQL.

If we keep doing things the same way then the result is always going to be the same unless we take a different approach, such is the nature of a computer. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby goodeit » 09. December 2011 23:24

Sharley,
I "gave up" so to speak and moved xampp to C:\xampp, but it's still not starting! Now it's giving a strange error about http-perl.conf.

httpd.exe: Syntax error on line 458 of C:/xampp/apache/conf/httpd.conf: Could no
t open configuration file C:/xampp/apache/conf/extra/httpd-perl.conf: The system
cannot find the file specified.


This is true, the file does not exist. Not sure why it wants it to be there though lol. I edited httpd.conf to comment out line 458, and now it starts fine! I'll try moving it back to the desktop and see if it is now going to launch portably as well.

Sidenote: I'm pretty sure I had the VC9 runtime, but I went ahead and reinstalled it, which could have helped.

Thanks again for all of your help! I'll let you know what happens when I try moving it.
goodeit
 
Posts: 8
Joined: 09. December 2011 02:47
Operating System: Windows 7

Re: ServerRoot Relative, DocumentRoot Relativity Problem

Postby Sharley » 09. December 2011 23:38

Remember what I said about zero length files and the method used to extract the archive files.
Sharley wrote:BTW if you used IZArc freeware to extract the files then there is a known bug that it does not extract all the files from the archive, it does not extract zero length files which are needed in XAMPP.
So use a zip extracting utility like WinRar or WinZip (not tested) or 7zip etc.
See this topic for in depth research results:
viewtopic.php?f=16&t=48955

Edit:
Where I have mentioned 7zip it should read IZArc as 7zip does indeed extract all the files correctly.

httpd-perl.conf is one of those zero length files and there are many in the XAMPP release that need to be extracted, it would be safe to say that no zero length files have been extracted.
(Another reason not to use a disk clean-up utility on the xampp folder as they also delete zero length files and temp/tmp folders).

Open the archive file and look in \xampp\apache\conf\extra folder and you will see the httpd-perl.conf file.

Open the archive file and look in \xampp\mysql\data\mysql folder and you will see several zero length files.

Now go to your installation and check the same folders and see if they too have the same zero length files included and if not then your archive extraction application is either IZArc or is not configured correctly to extract ALL including zero length files..

If your application used to extract the xampp zip file is not configured to extract ALL files then this can have serious results in the running of the components as we are seeing now - they must be extracted.

Good luck with the trial move. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 58 guests