Apache only works with certain document root folders?

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

Re: Apache only works with certain document root folders?

Postby Wiedmann » 06. May 2009 13:23

how do I go about getting apache getting to accept a folder like //192.168.1.5/Shared ?

Just use this path in the Apache config (if this is the correct one). And run the service with a user which have privileges to this path.
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 » 10. May 2009 10:22

Finally got it working. I dunno what was wrong, but it kept refusing the //192.168.1.5/Shared path, even though it was 100% surely a correct, existing, valid path with full read & write access.

Running the Apache server as a user account (instead of System) did not seem possible, it kept saying "logon failure".

However I did manage to get the subst working in the System account (and to my surprise the subst is then also available in my user account) and now it works.. Thanks again for the help! Image
Kazimir82
 
Posts: 9
Joined: 05. May 2009 16:47

Re: Apache only works with certain document root folders?

Postby ws24 » 15. January 2010 21:51

However I did manage to get the subst working in the System account (and to my surprise the subst is then also available in my user account) and now it works..

How did you do this??

I find advice in http://httpd.apache.org/docs/1.3/win_service.html but cannot get it to work.
A service that runs in the context of the LocalSystem account inherits the security context of the SCM. It is not associated with any logged-on user account and does not have credentials (domain name, user name, and password) to be used for verification.

The SYSTEM account has no privileges to the network, so shared pages or a shared installation of Apache is invisible to the service. If you intend to use any network resources, the following steps should help:

That explains why it won't work. There is a detailed description how to do it, but I will not use it as it seems to work only with passwords. I just want to switch between my notebook and desktop machines and the network drives are external drives hooked to one or the other. I hate to identify myself in my own office, so one user and no password. I'd rather not use the service then - unless you tell the trick.
ws24
 
Posts: 1
Joined: 15. January 2010 20:50

SOLUTION: Using Subst for Virtual Drive for Apache in Window

Postby twohawks » 21. January 2011 00:13

Hi all,
I have been seeking a solution to this for two days, and I am testing a working one now.

Wiedman stated it is "not possble" to "get a mapped or subst'ed drive available to the SYSTEM user".
This is not true.

Kazimir82 said s/he "did manage to get the subst working in the System account (and to my surprise the subst is then also available in my user account) and now it works.."
(...but then, after all the attention you got for your question here you did not have the decency to share how you accomplished that !?)

Forums like this are meant for sharing solutions. When you get one, have the decency to share the details.

ws24, if you are still listening you may be interested in this ;^)

#######################
SOLUTION - USE SUBST FOR APACHE: this is a work in progress, but I have some things sorted, and this one is for "getting a mapped or subst'ed drive available to the SYSTEM user" so Apache and friends can see and use it!

So I thought I'd share it here, if for nothing other than posterity on the net, as this is a tough thing to get clear info about if you are not a programmer.
There is a bit of detail included here, and its not yet complete (fully tested yet). I have organized the info I have to this point as well as possible consdiering my time constraints.

Thank you to the poster's here (and elsewhere) for their questions and insights into this matter.


#######################
PREMLIMINARY NOTES:

1)I am using WAMPSERVER , so this implementation is specific to that, however the Windows relevant tenets are universal. What is not universal is how I have customized Wamp, so there are two significant things to keep in mind:
- one of which I have posted at http://www.wampserver.com/phorum/read.php?1,35742 having to do with customizing the menu and basic wamp ops,
- the second thing having to do with tayloring my wamp,apache,mysql,and php setup files for relative paths, which works rather well for my PortableUSB application. I can plug in my key, make two edits, and go.
I am not going to get into the details of these things, but it does well to know about it for proper framing of my dialog in my personal notes shared here.

2) Get "RunAsSystem": a tool you can use to run something under System Authority to help in testing. For instance...
- Run cmd via RunAsSystem to instntiate a cmd window as System - Global User.
- Then in the cmd window Type in "whoami" to observe the User context within which the current cmd instance is running.
- Type in Net Use or Subst to observe what mounts are available to this User context.
- Open another cmd window as you normally would and do the same
- Use these two cmd instances for applying and observing differences in these (and other) processes and settings you initiate.

3) Get SysInternals "Process Monitor": it can help you observe where pathway calls break after launching your processes (apache, mysql, php-win, etc) ...for testing virtually mounted folder points. For instance, launch your server from your virtual mount point and observe where it fails as it switches from the subst path (or a mount point) out to the local path (etc).

4) Bottomline for local folder mounted as virtual drive...
- Typical 'Subst' method will not work (I explain a little about why below). Use instead "Dos Device" subst method per below notes.
- 'Net Use' on a local share may yet work, but I need more time for testing a few more approaches with it.

*********************************
Four basic things to get DosDevice Subst to work, then, are:
- my.ini :edit/add driveletter assignment. Relative paths won't work for subst methods.
- wampmanager.conf :edit installDir and sitesDir to correct driveletter
- wampmanger.ini :edit driveletters in at least line 19, possibly throughout [sometimes needed]
- edit Registry per detail below in #X for 1)accomodating wamp, and 2) assigning subst via DosDevice as System Authority


==========================
METHOD(S) {broken out into sections 1, 2, 3, and X}

1. DRIVE SUBSTITUTION FOR LOCAL FOLDER TESTING (preamble): I keep a folder "PortableUSB" on my PC that contains the exact file structure of the one I carry. The apps I run off the USB are (cloned and)run on the native PC from a Virtual Drive so as to emulate a mirror of the USB Device. This has many advantages as far as testing, backing up, syncing, keeping things simply and congruently organized, maintaining consistent securities, and many many other advantages.

"Subst" provides a simple solution for assigning a Drive Letter to a folder for emulating a USB-Drive (*except not as an actual "removable drive"*), but any apps requiring running as System User, such as Wamp/Apache, will not track thru the Subst Drive Letter, defaulting instead (where capable) to the local path, breaking functionality when it does (I tracked this using Process Monitor.. stuff starts out parsing via path X:\ and the fails, and then finds and begins trying to parse the local path C:\<path>\etc, utterly failing...).

And no, I have found no possible method for creating a Virtual 'Removeable Drive' from a folder. This is due to intimately technical properties of folders vs devices in the Windows operating system that seemingly cannot be overcome within the system (not via any api or anything I could find).
The only thing I have not investigated to conclusion in this regard is using a junction, which I saw mentioned somewhere (but did not seem plausible to me). Having exhausted all other possibilities, this would be the only method I have not investigated to conclusion.

--------------------
METHODS: There are 4 ~methods I know of for mounting virtual drives...
subst / dosdevice,
net use / SetVolumeMountPoint.
Discussed below are details shedding a light on the subst problem, and one method for trying to use it in proper context.

-------------------------
AT ISSUE: Apache cannot start on a typical Subst Drive assignment for a folder as this does not by default run within the LocalSystem context but under an authentication ID (LUID - locally unique identifier) associated with the current logon session when created, i.e., the Local User and not NT Authority / System.
READ THIS: http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Check out Local vs Global namespace inclusion.
"Note that only processes running in the LocalSystem context can call DefineDosDevice to create an MS-DOS device in the Global MS-DOS device namespace."

And one does not (cannot) affect a so-called System User mount point when using Susbt from a System User, like using RunAsSystem or other tools or methods for initiating commands via the NT Authority. This will not achieve what is needed. It can, however, be achieved via the DosDevice API function in Windows. Typical write-ups for using this function appear for DLL and Driver development schemes, but it seems we can access this in the registry and/or via scripting. I am currently testing the registry method, and so far it is working.


I have been looking into an easy way (without having to write a dll and handler/driver-installer for DosDevice implementation) to map a folder to a virtual drive using either 'Susbt' or 'Net Use' off a folder shared locally (using \\mypcname\sharename - which is feasible).
*I have tried methods involving instantiation of these mounts alternatively via Local and System user contexts (with the help of RunAsSystem tool), with mixed results...

++++++++++++++
a - Net Use to a local share (although it mounts) failed miserably, but I still have a few things left to test.
b - Direct Subst failed for the most part.
c - **DosDevice subst instantiation thru the registry seems to work if I edit some pathways in Wamp setup files ! Check whats happening using subst from a cmd prompt (via both local and system user ->see RunAsSystem tool cited above for the latter). This is the method outlined below, but while I do have it working today, I have not yet fully tested it.

++++++++++++++
!! - BTW, If you cannot run off the virtual mounted drive (folder resident on the systemdrive), A Possible work around is to pack the Wamp build into a "bin" that can be mounted locally as a CD. This is the next best thing to creating a Virtual Removable Drive, which itself is not possible.

+++++++++++++++
Lastly, it is possible to write your own DosDevice Mounting utility using WMI, VB, C+, AutoHotKey, and various other advanced scripting methods that can access the API. I bet it can be done with VBscript based on the VB implementations I have seen, but I have not taken time to work that out.


==========================
2.
***DOSDEVICE SUBST ASSIGNMENT METHOD THAT SEEMS TO BE WORKING (reboot required [this creates a persistent assignement])
Code: Select all
Windows Registry Editor Version 5.00

; Add This Reg Entry (file method)
; (see how to create persistent subst http://alter.org.ua/docs/win/persist_subst/ )
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"S:"="\\??\\C:\\PortableUSB"


In the registry it will look like this (so you can manually add it this way)...
A String Name of "S:" (without the quotes. Use your preferred DriveLetter, of course)
This String's Value is "\??\C:\PortableUSB" (without the quotes. Use your own path, of course)


! Reboot Required
! Assignment is Persistent
! Must be used in conjunction with methods outlined in #2, #3 and #X below !
! TEST RESULT: I see this subst volume in both local and system user instances (check with runassystem tool), and Apache/MySQL/PHP-Win all see it ;^)


==========================
3.
FOR WAMPACHE TO RUN Check Path/RootDrive Adjustments in (most of) the following files...
(NOTE: This assumes you are using relative paths in the critical files [my setup], otherwise there will be lots of other places to make changes)

In File - %drive%:\<path>\Wamp\bin\mysql\mysql5.0.51b\my.ini
***DosDevice Subst method Requires adding Drive Letter, otherwise TYPICALLY it is LEFT OUT
- basedir=/wamp/bin/mysql/mysql5.0.51b
- log-error=/wamp/logs/mysql.log
- datadir=/wamp/bin/mysql/mysql5.0.51b/data

In File - %drive%:\<path>\Wamp\wampmanager.conf ***Always Adjust These
- installDir = "S:/Wamp" <--where my Virtual Mount is
- sitesDir = "R:/SITES" <--where my Sites folder is kept

In File - %drive%:\<path>\Wamp\wampmanager.ini ***Always Adjust Drive Letter on at least Line#19. Rest of paths should change dynamically, but I have seen them stay staticly set to last ?? Does not seem to depend on the registry issue cited in notes below) Hmmm?

==========================
X. Registry:
Wamp evidently sets some paths for wamp apache and mysql in the CurrentControlSet and in the User Key which can remain persistent. If this is the case, then apache and/or swl will not function !

CHECK: (adjust to subst drive\path)
HKLM\SYSTEM\CurrentControlSet\Services\wampapache imagepath
HKLM\SYSTEM\CurrentControlSet\Services\wampmysqld imagepath

Also see [possible path problems?]:
HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\ShellNoRoam\MUICache
- Aestan Tray Menu
- Apache http server

-
HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache
- Aestan Tray Menu
- Apache http server



Just make sure the values appearing there reflect the intended pathways.
! - If you have installed Wamp on your hard drive (I use a portable implementation only) there may be otehr registry entry considerations I am not covering here, so beware.

===============================
Other resources
http://www.autohotkey.com/forum/topic17090.html
http://www.indigorose.com/forums/thread ... e?p=133048
http://alter.org.ua/soft/win/psubst/
Beware this: http://support.microsoft.com/default.as ... -us;106276
(I have not observed the problem -yet-, but thought I should include that.)


#####################################
End

I looked all over the net and have had a hard time finding comprehensive information for helping sort out this issue. While this post isn't comprehensive, I hope others investigating this problem for solutions may find this helpful.

Cheers,
TwoHawks
Love is the Function.
No Form is the Tool.
User avatar
twohawks
 
Posts: 1
Joined: 20. January 2011 21:18
Location: Stateline, NV USA

Previous

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 120 guests