Document Root does NOT function properly

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

Document Root does NOT function properly

Postby ajax » 11. December 2018 23:16

in XAMPP 7.2.12 for Windows.

This is a more concise reference to the problem originally posted in the topic found at https://community.apachefriends.org/f/viewtopic.php?f=16&t=77634
As it turns out the only thing that had to be done, after quite a bit of time spent troubleshooting, to overcome that problem was to stop trying to use the relative type reference to the relevant root directory and to specify the absolute path to the desired directory within each virtual host definition.

Even though the instance of "HTTPD.CONF" referred to by /xampp/apache/conf/httpd.conf contains the following lines:

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

it seems that when a relative style document root such as the following:

<VirtualHost *:80>
DocumentRoot "RootForMySite"
...
<Directory "RootForMySite">
...
</Directory>
</VirtualHost>

then the directory Apache seems to be using is "/xampp/apache/RootForMySite" instead of "/xampp/htdocs/RootForMySite". Interestingly, this new version of xampp defines a variable that was not used in my prior version of xampp as follows:

Define SRVROOT "/xampp/apache"

which appears to be used instead of "/xampp/htdocs" as specified in "httpd.conf".

If I've failed to recognize something I should have please advice. Otherwise it would be nice to correct this problem so that Apache will function properly.
ajax
 
Posts: 35
Joined: 14. December 2010 17:57
Operating System: Windows 2000 Professional

Re: Document Root does NOT function properly

Postby Nobbie » 12. December 2018 00:00

It has nothing to do with SRVROOT, it is all about ServerRoot:

https://httpd.apache.org/docs/2.4/en/mo ... serverroot

The ServerRoot directive sets the directory in which the server lives. Typically it will contain the subdirectories conf/ and logs/. Relative paths in other configuration directives (such as Include or LoadModule, for example) are taken as relative to this directory.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Document Root does NOT function properly

Postby ajax » 13. December 2018 18:00

I think I understand the difference between the variable (SRVROOT) and the directive (ServerRoot). All I was doing was pointing out that the variable (SRVROOT) was not defined in the httpd.conf file on my prior/old version of xampp. Also, it is not apparent to me what purpose it serves in the current/new version.

While not the most authoritative user of Apache I also thought I understood the difference between ServerRoot and DocumentRoot based on information in the link referenced above along with the link that follows:

https://httpd.apache.org/docs/2.4/en/mo ... cumentroot

My configuration files were coded with this in mind and worked just fine on the prior/old version of xampp (actually several prior versions) but the file named "/xampp/apache/conf/extra/httpd-vhosts.conf" fails on XAMPP 7.2.12 as described above. If I make only the alterations mentioned above that error no longer occurs. However, this means that the DocumentRoot directive as coded in the xampp supplied "HTTPD.CONF" file fails to function as described in the link above.

Based on both this experience and reading the Apache documentation describing directives I conclude it has nothing to do with ServerRoot. I only speculate it might have something to do with whatever purpose, as yet unknown to me, there is for defining the variable named "SRVROOT".
ajax
 
Posts: 35
Joined: 14. December 2010 17:57
Operating System: Windows 2000 Professional

Re: Document Root does NOT function properly

Postby Nobbie » 13. December 2018 19:49

Forget about SRVROOT. Whoever or whatever defined it, its not an Apache configuration Option.

To understand the difference between DocumentRoot and ServerRoot, it may be helpful (even if its not correct all the way, but mostly), the DocumentRoot applies at runtime, whereas ServerRoot applies at configuration time to the Apache server. ServerRoot is the answer to the server "Where am i running", as DocumentRoot is the answer to the question (both for Apache and the browser) "Where is this domain/host stored".

And anyway, its always critical to use relative pathnames (as in your case), because sometimes it might be difficult to determine and understand, which full path results from the relative path. It can be usefull to use relative pathnames, but it also may confuse. Use full pathnames as often as possible.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 134 guests