# Windows network: Set apache DocumentRoot in network directory

I set a network with a physical machine and a virtual machine, both with Windows 7.

I set an apache server in the virtual machine to listen in port 80, now it's working if I set DocumentRoot inside virtual machine (same one than Apache Server), but I would like my documents to be in physical machine directory, and if I try to set DocumentRoot in a network directory I get an error in Event Manager saying DocumentRoot must be a directory.

• In the Apache machine I added this directory as a network unit, like Z:/myfolder
• In the physical machine I set this folder as Shared and give permissions to All for reading and writing

I'm not very good configuring networks so I may be missing something about permissions or whatever, but when I open this folder in Windows explorer I'm not prompted for login or anything.

-
Does the user that Apache is running as have the Z: drive mapped, or just your user? – Shane Madden Dec 30 '11 at 17:31
How can I know that? The Apache system is being runned by "Local System" so you might be in the right direction... But how can I add this folder for "Local System"? Thank ypu – user761076 Dec 31 '11 at 10:13

First recommendation: get rid of the drive letter, and just use the UNC path in Apache's config - it should work just fine.

If for some reason you need to keep mapping the drive, then the better option would be to change the user that Apache's running as, and create a drive mapping under the new account for the Apache service.

But, if you do want to keep it running as local system, there's an ugly hack that can do the trick; grab psexec, run psexec -i -s cmd.exe, then map the drive with net use z: \\path\to\share /persistent:yes.

-
I'll try that, is a development environment and apache is on virtual machine so don't mind doing ugly hacks, thank you – user761076 Jan 1 '12 at 23:12
After trying, I encounter a new problem: when I run command prompt through psexec I don't see host machine, my user in that command promt is VIRTUALMACHINE$(good, that's the user I want to give access) but this user does not even see HOST_MACHINE. How can I get this user to see HOST_MACHINE? HOST_MACHINE has total control access to EVERYBODY and VIRTUALMACHINE$ dos not see it... – user761076 Jan 2 '12 at 12:38
Clarify what you mean by "does not even see HOST_MACHINE". Did you try a net use command? What was the result? And again, why are you not using UNC paths instead?? – Shane Madden Jan 3 '12 at 6:43
Well, today, after restoring an older snapshot of my Virtual Machine it works so I don't really get the point of all this but I'm going on for the moment. With HOST_MACHINE I meant physical machine hosting virtual one, they're supposed to be in same network, and I think I'm using UNC paths: \\MACHINE\myfolder\. Thank you for your help – user761076 Jan 3 '12 at 8:46