[Owncloud] Apache UserDir Environment

Lukas Pirl mail at lukas-pirl.de
Fri Feb 10 14:08:45 UTC 2012


Hey List!

First of all: ownCloud seems to be awesome at the first glance! :)

I just configured ownCloud in a shared webhosting environment and a minor 
problem occured.
On this server, every user got its own UserDir[1] what seems to confuse 
ownCloud.

First, I got an error because of an open_basedir restriction:
To set the OC::$DOCUMENTROOT you use realpath() what tries to open 
$_SERVER['DOCUMENT_ROOT'] what is outside the allowed paths for PHP since my 
scripts are in my UserDir (!= $_SERVER['DOCUMENT_ROOT']).
This is known PHP behaviour and the PHP folks are - with good reasons - not 
willing to change this [2].

Then, while reading lib/base.php, I found a substr() call that was used to 
traverse upwards in a directory using hardcoded value for the string leth of 
"lib/base.php". Well... :) This is an aesthetic flaw.

Without knowing anything (!) about the code of ownCloud, I changed these two 
issues for my installation and everything seems to work. I assume that these 
two things do *not* have a specific reason to be done like this.
See attached patches.

By the way: I did not try this with/did not apply this on the webfinger app but 
it seems to have a very similar detection for the $DOCUMENTROOT.

Regards,

Lukas Pirl

[1] http://httpd.apache.org/docs/2.0/mod/mod_userdir.html
[2] https://issues.apache.org/bugzilla/show_bug.cgi?id=26052
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serverroot_detection.patch
Type: text/x-patch
Size: 545 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20120210/7e70fadb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no_documentroot.patch
Type: text/x-patch
Size: 816 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20120210/7e70fadb/attachment-0001.bin>


More information about the Owncloud mailing list