diff --git a/lib/base.php b/lib/base.php
index 4f89a70db94cb76dccc0fe927a639355f573c0cf..90e64f13af616dbc22221d445333cb74d4304dad 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -125,6 +125,13 @@ class OC {
 	public static function initPaths() {
 		// calculate the root directories
 		OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4));
+
+		// ensure we can find OC_Config
+		set_include_path(
+			OC::$SERVERROOT . '/lib' . PATH_SEPARATOR .
+				get_include_path()
+		);
+
 		OC::$SUBURI = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT)));
 		$scriptName = OC_Request::scriptName();
 		if (substr($scriptName, -1) == '/') {
@@ -144,12 +151,6 @@ class OC {
 			OC::$WEBROOT = '/' . OC::$WEBROOT;
 		}
 
-		// ensure we can find OC_Config
-		set_include_path(
-			OC::$SERVERROOT . '/lib' . PATH_SEPARATOR .
-				get_include_path()
-		);
-
 		// search the 3rdparty folder
 		if (OC_Config::getValue('3rdpartyroot', '') <> '' and OC_Config::getValue('3rdpartyurl', '') <> '') {
 			OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', '');