diff --git a/authorize.php b/authorize.php
index 3c0bd7b..e5d7b6b 100644
--- a/authorize.php
+++ b/authorize.php
@@ -21,11 +21,6 @@
  */
 
 /**
- * Root directory of Drupal installation.
- */
-define('DRUPAL_ROOT', getcwd());
-
-/**
  * Global flag to identify update.php and authorize.php runs, and so
  * avoid various unwanted operations, such as hook_init() and
  * hook_exit() invokes, css/js preprocessing and translation, and
@@ -59,17 +54,18 @@ function authorize_access_allowed() {
 
 // *** Real work of the script begins here. ***
 
-require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
+require_once './includes/bootstrap.inc';
+
+// We prepare only a minimal bootstrap. This includes the database and
+// variables, however, so we have access to the class autoloader registry.
+drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
+
 require_once DRUPAL_ROOT . '/includes/session.inc';
 require_once DRUPAL_ROOT . '/includes/common.inc';
 require_once DRUPAL_ROOT . '/includes/file.inc';
 require_once DRUPAL_ROOT . '/includes/module.inc';
 require_once DRUPAL_ROOT . '/includes/ajax.inc';
 
-// We prepare only a minimal bootstrap. This includes the database and
-// variables, however, so we have access to the class autoloader registry.
-drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
-
 // This must go after drupal_bootstrap(), which unsets globals!
 global $conf;
 
diff --git a/cron.php b/cron.php
index c6ce531..bc7cbc7 100644
--- a/cron.php
+++ b/cron.php
@@ -5,12 +5,7 @@
  * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
  */
 
-/**
- * Root directory of Drupal installation.
- */
-define('DRUPAL_ROOT', getcwd());
-
-include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
+include_once './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
 if (!isset($_GET['cron_key']) || variable_get('cron_key', 'drupal') != $_GET['cron_key']) {
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 677b216..621b42e 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -230,6 +230,11 @@ define('REGISTRY_WRITE_LOOKUP_CACHE', 2);
 define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*');
 
 /**
+ * Used to dynamically grab the doc root without using php globals
+ */
+define('DRUPAL_ROOT', getcwd());
+
+/**
  * Provides a caching wrapper to be used in place of large array structures.
  *
  * This class should be extended by systems that need to cache large amounts
diff --git a/index.php b/index.php
index 8b83199..8ac9038 100644
--- a/index.php
+++ b/index.php
@@ -11,11 +11,6 @@
  * See COPYRIGHT.txt and LICENSE.txt.
  */
 
-/**
- * Root directory of Drupal installation.
- */
-define('DRUPAL_ROOT', getcwd());
-
-require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
+require_once './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 menu_execute_active_handler();
diff --git a/xmlrpc.php b/xmlrpc.php
index b202dc2..1b83b58 100644
--- a/xmlrpc.php
+++ b/xmlrpc.php
@@ -5,12 +5,7 @@
  * PHP page for handling incoming XML-RPC requests from clients.
  */
 
-/**
- * Root directory of Drupal installation.
- */
-define('DRUPAL_ROOT', getcwd());
-
-include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
+include_once './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 include_once DRUPAL_ROOT . '/includes/xmlrpc.inc';
 include_once DRUPAL_ROOT . '/includes/xmlrpcs.inc';
