DOCUMENT_ROOT on Subdomains

Having trouble installing serendipity?
User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

DOCUMENT_ROOT on Subdomains

Post by yellowled » Wed Apr 11, 2012 4:44 am

garvinhicking wrote:Can you ask the Ubernauten what their specific reason is for not making DOCUMENT_ROOT point to the directory which serves as "/" of the subdomain?
TL;DR: PHP is running as the system (i.e. my) user (through suExec) in an Uberspace.

The long version is documented in the Uberspace-Wiki (in German). According to their support, this is not an issue with most other blog systems/CMS, probably because they don't offer a shared installation and/or handle DOCUMENT_ROOT differently.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by garvinhicking » Wed Apr 11, 2012 11:02 am

Hi!

Let's see if you find this thread again ;)

So. The problem is really, even if "most" blogs/cmses do not rely on DOCUMENT_ROOT, still this special directive is really important to s9y, much more important if a s9y installation already exists in the "lower" directory.

As I wrote earlier to Grischa, we could try to employ various fixes, but this would mean we'd have to test every other edge scenario again, and setup (complicated) setups to test this with, all of which is a massive body of work.

Technically it's also not very good, that the Ubernauten do this kind of trick. I mean, the document root of a VHost is the root of where all documents start, and not where the user himself has his home directory. Relying on that this will work on most PHP applications is a very optimistic approach, that will very likely break not only on Serendipity.

IMHO it would be nice to get into a discussion on how the Ubernauten and other Webproviders can find a way to delegate the technically correct document root to a subdomain, without losing their suexec specific setup. I am not an expert webhoster, so there definitely might be problems with this, but as an application developer supporting different scenarios, I have a problem with setups where the document-root is not what it's intention actually would imply.

A suggestion I made before was to create a .htaccess file to set a php "auto_prepend_file" that points to a PHP file which sets $_SERVER['DOCUMENT_ROOT'] to the proper directory.

If there is a way in PHP code with which we can EXACTLY identify a Ubernauten-Setup (or any of this redirected subdomain document root), I can put this into the s9y code; but this can not have side-effects on other installations, so this "ubernauten"-Check needs to be foolproof, best due to some $_ENV setting.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Wed Apr 11, 2012 1:26 pm

garvinhicking wrote:As I wrote earlier to Grischa, we could try to employ various fixes, but this would mean we'd have to test every other edge scenario again, and setup (complicated) setups to test this with, all of which is a massive body of work.
Personally, I've had enough with the tests I already did. :)
garvinhicking wrote:IMHO it would be nice to get into a discussion on how the Ubernauten and other Webproviders can find a way to delegate the technically correct document root to a subdomain, without losing their suexec specific setup.
I'm not an expert in PHP or web server setup, so I can't really comment on whether this setup is reasonable or not. I'm pretty sure it fits their philosophy of web hosting which might be a bit quirky, but works just fine for me as an end user.

I also realize that this is a special use case with just one hoster which is gaining popularity, but not really suitable for any end user. Then again, it's not that special to have seperate blogs on subdomains. We can't even rule out that other hosters might use a similar setup.

I guess the Ubernauten guys would be open to a discussion, but given the fact that I don't understand most of this in the first place, I'm not the best candidate to raise this discussion. :)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by garvinhicking » Wed Apr 11, 2012 3:14 pm

Hi!

I'm not a customer of theirs (by "non-chance", not by "non-willing" *g*) so I IMHO don't have the authority to request discussion of their methods. Maybe one of their customers ( :-) ) can forward a message like this:
Some PHP applications like the s9y PHP blog do not properly work when the root of a URL is not the root level directory (DOCUMENT_ROOT) on the webspace. The developers of s9y do want to try to find a way to support such non-standard directory setups to work despite of this, however need to ensure this does not conflict with other modes of operation of their software.

Their developers ask, if there is a environment variable, or some other attribute that can be checked within PHP code to detect if such a Ubernaut-Setup exists (like $_ENV['IS_UBERNAUT']) so that they can add a code fork to correct the current directory name, once such an environment is detected.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Wed Apr 11, 2012 3:38 pm

garvinhicking wrote:I'm not a customer of theirs (by "non-chance", not by "non-willing" *g*) so I IMHO don't have the authority to request discussion of their methods. Maybe one of their customers ( :-) ) can forward a message like this:
Sounds like a perfect job for Grischa. :mrgreen:

BTW: The Uberspace folks are German. You and I are German. Everybody I know who's using s9y on Uberspace is German. Why are we discussing this in English again? :)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by garvinhicking » Wed Apr 11, 2012 6:33 pm

In 100 years from now we'll all be speaking english, so this is to preserve history.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Wed Apr 11, 2012 10:48 pm

1st attempt with your fixed version: export of master. Before even getting to the settings screen, I get

Code: Select all

== TESTING ERROR MODE ==

Fatal error: Uncaught exception 'ErrorException' with message 'Serendipity error: dirname() expects exactly 1 parameter, 2 given' in /var/www/virtual/user/foo.bar.tld/include/compat.inc.php:106
Stack trace:
#0 [internal function]: errorToExceptionHandler(2, 'dirname() expec...', '/var/www/virtua...', 205, Array)
#1 /var/www/virtual/user/foo.bar.tld/include/functions_installer.inc.php(205): dirname('/var/www/virtua...', '/')
#2 /var/www/virtual/user/foo.bar.tld/include/admin/installer.inc.php(23): serendipity_query_default('serendipityPath', false)
#3 /var/www/virtual/user/foo.bar.tld/serendipity_admin.php(362): require('/var/www/virtua...')
#4 {main}
  thrown in /var/www/virtual/user/foo.bar.tld/include/compat.inc.php on line 106
Since I was feeling experimental (and wasn't sure I did the master export properly), I tried 2.0 as well, but since that threw the same error message …

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by garvinhicking » Thu Apr 12, 2012 1:42 pm

Hi!

Sorry. Seems I set the wrong closing parentheses; just updated, please try again if you can. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Thu Apr 12, 2012 2:36 pm

garvinhicking wrote:Seems I set the wrong closing parentheses; just updated, please try again if you can. :)
Just installed a current master on a subdomain without any issues besides that the (advanced) installation did not show a version number in the footer until the final step (it just says "Powered by Serendipity and PHP …"). Yay! :)

Next up: 2.0-alpha on another subdomain.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Thu Apr 12, 2012 2:40 pm

yellowled wrote:Next up: 2.0-alpha on another subdomain.
Same thing, again using an advanced installation. All paths etc. properly detected, too, but the version number wasn't displayed until the installation was completed.

Do you need any further testing, a simple installation or something?

EDIT: Oh, also, none of these compromised my main blog on the domain. Yay! :)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by garvinhicking » Thu Apr 12, 2012 3:44 pm

Hi!

Hm, I'm actually not sure on the version number thing, could be that this never was there on installation? I've not installed s9y for a long time *g*

Anyhow: Great to hear this works! Yay for us!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Thu Apr 12, 2012 4:16 pm

garvinhicking wrote:Hm, I'm actually not sure on the version number thing, could be that this never was there on installation? I've not installed s9y for a long time *g*
I've done about a dozen installation over the last 2 days, but I have not once actually looked at that, so no idea. :mrgreen:

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Thu Apr 12, 2012 4:25 pm

One more thing: Shouldn't this go into the 1.6 branch as well in case we need a quick 1.6.1 or something?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by garvinhicking » Thu Apr 12, 2012 6:25 pm

No, actuall not. This still MIGHT break things. The advantage of the fix does not outweigh the potential damage, so I'd rather keep it in the master...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 6986
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: DOCUMENT_ROOT on Subdomains

Post by yellowled » Thu Apr 12, 2012 7:01 pm

garvinhicking wrote:This still MIGHT break things.
How do we test that?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply