diff --git a/core/authorize.php b/core/authorize.php
index a676ee1..0b1d461 100644
--- a/core/authorize.php
+++ b/core/authorize.php
@@ -28,7 +28,7 @@
 use Drupal\Core\Page\DefaultHtmlPageRenderer;
 
 // Change the directory to the Drupal root.
-chdir('..');
+chdir(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
 
 $autoloader = require_once __DIR__ . '/vendor/autoload.php';
 
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index ea2a742..cd8a44f 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -208,9 +208,16 @@
 /**
  * Defines the root directory of the Drupal installation.
  *
- * This strips two levels of directories off the current directory.
+ * In some cases Drupal root might not be located two levels down of this file's
+ * directory. This may be the case when /core is symlinked. So __DIR__
+ * cannot be used for deriving DRUPAL_ROOT. We have to rely on the current
+ * working directory, but therefore scripts including bootstrap.inc have to
+ * chdir() to the appropriate Drupal root directory.
+ *
+ * @see core/install.php
+ * @see https://www.drupal.org/node/1792310
  */
-define('DRUPAL_ROOT', dirname(dirname(__DIR__)));
+define('DRUPAL_ROOT', getcwd());
 
 /**
  * Returns the appropriate configuration directory.
diff --git a/core/install.php b/core/install.php
index 4fdda9a..356db2f 100644
--- a/core/install.php
+++ b/core/install.php
@@ -6,7 +6,7 @@
  */
 
 // Change the directory to the Drupal root.
-chdir('..');
+chdir(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
 
 /**
  * Global flag to indicate the site is in installation mode.
diff --git a/core/modules/statistics/statistics.php b/core/modules/statistics/statistics.php
index 4d20046..264b9de 100644
--- a/core/modules/statistics/statistics.php
+++ b/core/modules/statistics/statistics.php
@@ -8,7 +8,7 @@
 use Drupal\Core\DrupalKernel;
 use Symfony\Component\HttpFoundation\Request;
 
-chdir('../../..');
+chdir(dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])))));
 
 $autoloader = require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php';
 
diff --git a/core/rebuild.php b/core/rebuild.php
index c915aff..3fb102e 100644
--- a/core/rebuild.php
+++ b/core/rebuild.php
@@ -16,7 +16,7 @@
 use Symfony\Component\HttpFoundation\Request;
 
 // Change the directory to the Drupal root.
-chdir('..');
+chdir(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
 
 $autoloader = require_once __DIR__ . '/vendor/autoload.php';
 require_once __DIR__ . '/includes/utility.inc';
