On Mon, Dec 13, 2010 at 11:35, Stefan Fritsch <[email protected]> wrote: > On Monday 13 December 2010, Ondřej Surý wrote: >> On Mon, Dec 13, 2010 at 04:15, William A. Rowe Jr. <wr...@rowe- > clan.net> wrote: >> > On 12/12/2010 4:23 PM, Stefan Fritsch wrote: >> >> On Wednesday 10 November 2010, Stefan Fritsch wrote: >> >>>> The frequency with which this gets asked seems to make it >> >>>> worthwhile doing something, even if this patch isn't the right >> >>>> thing to do. >> >>> >> >>> Maybe the larger solution of having a document_root field in >> >>> the request_rec would be better. Has anyone had a chance to >> >>> look at Ondrej's patch, already? I didn't get around to doing >> >>> it, yet. >> >>> >> >>> https://issues.apache.org/bugzilla/show_bug.cgi?id=49705 >> >> >> >> I have looked at the patch and it looks reasonable. The fact >> >> that two known modules (mod_vhost_ldap and mod_ftp) copy the >> >> whole server_rec just to change the document root means that >> >> this feature is needed. >> >> >> >> Well, at least for mod_ftp it is... >> >> >> >> I am wondering if the people who want this for mod_vhost_* >> >> actually want something else, namely an easy way to get the >> >> root dir of a web application in php/cgi/whatever... >> >> >> >> What about this idea: >> >> >> >> Add two new cgi env variables: CONTEXT_ROOT and >> >> CONTEXT_ROOT_PATH (or APP_ROOT/APP_ROOT_PATH or ...). And add a >> >> new config directive >> > >> > Feh... DOCUMENT_ROOT was bad enough, do we have to persist the >> > concept of sharing such things with the app? For that matter, >> > what are the vars that are used in app doc models today, why >> > would we have to invent this again? > > These things are handled nicely in the JEE world by AJP and the > servlet container. They don't seem to work all that well in the > CGI-/PHP-world. > > And DOCUMENT_ROOT is broken if used with mod_alias or mod_userdir. Why > not replace it with something that works? A different idea with no > additional directive: > > BASE_PATH points to the filesystem path of an > alias/userdir/documentroot > > BASE_URI points to the URI prefix that is equivalent to BASE_PATH. > Maybe this should already include scheme and hostname, to take care of > ssl-offload, reverse proxies, etc. > > A self-referential URL could then be constructed by cutting BASE_PATH > from SCRIPT_FILENAME and prepending BASE_URI. > >> It's not only about the DOCUMENT_ROOT variable. The main problem is >> interaction with other modules. Mainly mod_rewrite, which uses the >> document root for -f and -d checks. > > mod_rewrite could then use BASE_PATH instead of DOCUMENT_ROOT, in > order to keep working in presence of aliases, etc.
Seems to be a good idea (although it creates need to patch many thing beyond the apache core). I would be happy to throw some code (could be based on my earlier patch) to make this happen. CGI handling is broken in m-v-l anyway, since I wasn't able to figure out how to put the pieces of ap_document_root and mod_cgi(d) together. However it's on my todo list (and since I already have two bug reports, I ought to fix it sooner or later...) Ondrej -- Ondřej Surý <[email protected]>
