Windows network: Set apache DocumentRoot in network directory

apache-2.2windows 7

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.

Best Answer

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.