diff --git a/core/authorize.php b/core/authorize.php
index d033b7efb2825dcd87e78463b6b62921e6064242..d63d4dcda020fe7330b1d455eabbad97c54a5f48 100644
--- a/core/authorize.php
+++ b/core/authorize.php
@@ -28,7 +28,7 @@
 use Drupal\Core\Site\Settings;
 
 // 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 ae3f55ac27c151bd6d69effdf355d679c5978d8f..1f46303ab58b667ede1d3484517e1675489225a6 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -139,9 +139,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/includes/install.core.inc b/core/includes/install.core.inc
index d2c1312de069c76497c3a9982331f5d16cdd1d4d..5149a117ba555d05518bd8b75aa474a9d2640f07 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -305,7 +305,7 @@ function install_begin_request($class_loader, &$install_state) {
   }
 
   $site_path = DrupalKernel::findSitePath($request, FALSE);
-  Settings::initialize(dirname(dirname(__DIR__)), $site_path, $class_loader);
+  Settings::initialize(getcwd(), $site_path, $class_loader);
 
   // Ensure that procedural dependencies are loaded as early as possible,
   // since the error/exception handlers depend on them.
diff --git a/core/install.php b/core/install.php
index 3493d4a7702c3546194541a6722a460f6018fab8..aa5c940f33c153b52460a832eb81f3b8b75a2a70 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/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index d5e6059345b71206692d421fa6e884331bef978f..edc7f1413ebd1821abbfc3ccb79f199c55ef1e43 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -209,7 +209,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
    */
   public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE) {
     // Include our bootstrap file.
-    $core_root = dirname(dirname(dirname(__DIR__)));
+    $core_root = getcwd() . '/core';
     require_once $core_root . '/includes/bootstrap.inc';
 
     $kernel = new static($environment, $class_loader, $allow_dumping);
diff --git a/core/modules/statistics/statistics.php b/core/modules/statistics/statistics.php
index 4d2004646ae677a4afb40f9c17e29baaae234daf..9054b29dc801ecce4f5837869196bc0a7420d583 100644
--- a/core/modules/statistics/statistics.php
+++ b/core/modules/statistics/statistics.php
@@ -8,9 +8,9 @@
 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';
+$autoloader = require_once getcwd() . '/vendor/autoload.php';
 
 $kernel = DrupalKernel::createFromRequest(Request::createFromGlobals(), $autoloader, 'prod');
 $kernel->boot();
diff --git a/core/rebuild.php b/core/rebuild.php
index 7ca8af73bf2f9926f6b62b2700bbcd883307dd78..61f4b17caa45c36efad583b70722c66e77516082 100644
--- a/core/rebuild.php
+++ b/core/rebuild.php
@@ -18,7 +18,7 @@
 use Symfony\Component\HttpFoundation\Response;
 
 // 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';
