Apache only works with certain document root folders?

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

Apache only works with certain document root folders?

Postby Kazimir82 » 05. May 2009 17:01

When I edit httpd.conf to use some random (local) folder, and then start Apache, it works fine. But when I set it to a network mapped drive, it doesn't. For example, in httpd.conf, there is:

DocumentRoot "C:/WebRoot"
and somewhat below (where it says "This should be changed to whatever you set DocumentRoot to"), the <Directory> part starts with:
<Directory "C:/WebRoot">

All OK so far, Apache runs fine. But with these settings:

DocumentRoot "X:/DocRoot"
...
<Directory "X:/DocRoot">

Where X: is a mapped network drive (for example, after doing "net use X: \\192.168.1.5\SharedFolder" on the command line), then Apache does NOT work :(
When starting the service on the cmd line, "net start apache2.2" gives: "The Apache2.2 service could not be started. A service specific error occurred: 1"
The specified folder (in this case X:/DocRoot) certainly exists and I have full write access to it.

Even when the mapped drive letter actually points to a share on my own system (for example I have C:/WebRoot shared as "WebRoot", and then do "net use X: \\127.0.0.1\WebRoot"), Apache still won't start... :roll: I installed the latest version of Xampp (downloaded a few weeks ago, including the patch) and using Apache/2.2.11 for Windows.
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby Wiedmann » 05. May 2009 18:22

Where X: is a mapped network drive (for example, after doing "net use X: \\192.168.1.5\SharedFolder" on the command line), then Apache does NOT work

You must use a UNC path, and not a mapped network drive.

Additionally, your Apache user must have privileges to this UNC path (share).
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Apache only works with certain document root folders?

Postby Kazimir82 » 05. May 2009 20:58

Thanks for your reply. Exactly what do you mean with UNC path? What would be the UNC path for X:\ or \\192.168.1.5\SomeShare\ ?
Note that any other application can access files on that shared drive using X:/etc without any problem. In fact, it doesn't (well, shouldn't) even make a difference at all whether a drive letter refers to a real local drive, or a virtual folder. Except, apparently, for Apache it does :)

The share that X: maps to is shared with full rights, i.e. my machine (the one that runs Apache) has full write access to that X: drive (or to that share, it's the same). I can read, write, create and delete files and folders. Is that what you mean with privileges?
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby Wiedmann » 05. May 2009 21:06

What would be the UNC path for X:\ or \\192.168.1.5\SomeShare\ ?

"\\192.168.1.5\SomeShare" is the UNC path.

i.e. my machine (the one that runs Apache) has full write access to that X: drive (or to that share, it's the same).

You machine (SYSTEM account) can't have access to this share. Maybe your user have full write access.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Apache only works with certain document root folders?

Postby Kazimir82 » 06. May 2009 07:30

Wiedmann wrote:"\\192.168.1.5\SomeShare" is the UNC path.

Ah ok, but if I use that in httpd.conf, it doesn't work either :(
(also tried with forward slashes, same result)

Furthermore I looked in the error log, but Apache doesn't seem to log this error. Is there another way of getting Apache to report exactly what or why it's failing?

You machine (SYSTEM account) can't have access to this share. Maybe your user have full write access.

Right, good point. I assume the SYSTEM account (or whichever account is running Apache) needs access too.
But how do I go about that? On the other machine, with the shared folder, I already shared the folder with write access to anyone, and have set the security permissions to FULL for "Everybody". No password, no restrictions, etc. What else can I do?
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby Wiedmann » 06. May 2009 07:45

(also tried with forward slashes, same result)

You should always use forward slashes in Apaches config files.

Is there another way of getting Apache to report exactly what or why it's failing?

Every Windows service is logging it's problems into the Windows event log.

I assume the SYSTEM account (or whichever account is running Apache) needs access too.
But how do I go about that?

You can't (ok that's not really true...) give the SYSTEM account such privileges. You must run Apache with a (normal user) account which have privileges. (--> edit the service properties.)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Apache only works with certain document root folders?

Postby Kazimir82 » 06. May 2009 08:10

Wiedmann wrote:Every Windows service is logging it's problems into the Windows event log.

Ah ok, unfortunately that doesn't tell me much more:
Event Log wrote:Event Type: Error
Event Source: Service Control Manager
Event Category: None
Event ID: 7024
Date: 5/6/2009
Time: 8:29:09 AM
User: N/A
Computer: KAZIMIR637248
Description:
The Apache2.2 service terminated with service-specific error 1 (0x1).

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Can't I run Apache with some kind of verbose mode or anything, to make it report exactly why it fails?

You can't (ok that's not really true...) give the SYSTEM account such privileges. You must run Apache with a (normal user) account which have privileges. (--> edit the service properties.)

If I try that (I assumed you meant service properties -> Log On -> choosing my own account there). I fill in my username and password, click ok, then try to start the service again, but now it says "System error 1069 has occurred. The service did not start due to a logon failure." :(

I also tried something else: with C:/Temp/WebRoot as the documentroot path (and <directory ....> path) it works fine. Now, when I do subst X: C:\Temp (on cmd line) and then use X:/WebRoot in httpd.conf (and X:/WebRoot is an existing, perfectly valid path here, with full access, and all rights exactly the same as it has to C:/Temp/WebRoot), it does NOT work.

I've got a feeling that something fishy is going on, I really don't understand why Apache is so picky about that paths it does and doesn't accept... It just has to read some files, right?

Again thanks a lot for your help, if you have any further suggestions, please let me know! Much appreciated!
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby Wiedmann » 06. May 2009 09:19

Ah ok, unfortunately that doesn't tell me much more:

There are more then one log, you can view with the windows event viewer.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Apache only works with certain document root folders?

Postby Kazimir82 » 06. May 2009 10:13

Wiedmann wrote:
Ah ok, unfortunately that doesn't tell me much more:

There are more then one log, you can view with the windows event viewer.

Sorry, exactly where do you mean? I'm doing right-click on my computer, Manage, System Tools, Event Viewer.

I noticed the Apache events are logged not only under Applications, but also under System. But the (rather uninformative) logged error is the same in both.

Are you referring to something else?

Any additional ideas on the path issues? (even with the subst'ed local drive, to which Apache definitely has all rights and privileges?)
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby Wiedmann » 06. May 2009 10:20

I noticed the Apache events are logged not only under Applications, but also under System. But the (rather uninformative) logged error is the same in both.

Hm, your above screenshot is from the system log. The applications log should be different.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Apache only works with certain document root folders?

Postby Kazimir82 » 06. May 2009 10:24

My bad, you're totally right. Application log says:
The Apache service named reported the following error:
>>> DocumentRoot must be a directory .

But... why does it think that X:\WebRoot is not a directory? Neither when X:\ is a subst for C:\Temp, with C:\Temp\WebRoot being a valid path, nor when X: is a mapped network drive to \\192.168.1.5\RandomShare (which has a WebRoot subdir) and even when X:\ is a mapped drive to a local share (e.g. \\127.0.0.1\Temp)
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby Wiedmann » 06. May 2009 10:44

why does it think that X:\WebRoot is not a directory?

A service doesn't know anything about maped network drives from your user.

(BTW: Why did you use "X:\WebRoot", even if I advice you to use UNC paths?)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Apache only works with certain document root folders?

Postby Kazimir82 » 06. May 2009 12:40

Wiedmann wrote:(BTW: Why did you use "X:\WebRoot", even if I advice you to use UNC paths?)

Sorry for confusion, that was just an example (although it is a valid folder), but same goes for \\192.168.1.5\Shared (that doesn't work either, yet it certainly is a valid folder)

A service doesn't know anything about maped network drives from your user.

Ah, thanks, I'm getting further step by step :)
I didn't realize so much until today that services run as a different user than myself, and some subst'ed / network mapped drives may not be available.

Question narrowed down to: how do I get a mapped or subst'ed drive available to the SYSTEM user?
Or should I use a different approach? (considering that the UNC path for a network share doesn't seem to work)
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby Wiedmann » 06. May 2009 12:44

how do I get a mapped or subst'ed drive available to the SYSTEM user?

Not possible.

(considering that the UNC path for a network share doesn't seem to work)

Using UNC paths is the only way this can work.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Apache only works with certain document root folders?

Postby Kazimir82 » 06. May 2009 13:12

Ok, but then, how do I go about getting apache getting to accept a folder like //192.168.1.5/Shared ?
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 142 guests