diff --git a/autoload.php b/autoload.php
index 2c21bb2d3e..8788be95b5 100644
--- a/autoload.php
+++ b/autoload.php
@@ -13,12 +13,12 @@
$autoloader = include __DIR__ . '/vendor/autoload.php';
-if (!$autoloader) {
- header('500 Internal Server Error');
- print 'Dependencies error! The system cannot access some files in the vendor
folder.
' . PHP_EOL .
- 'Did you run composer install
? You may also need to check the folder permissions.
' . PHP_EOL .
- 'Refer to the the Drupal installation guide for instructions on installing with Composer.' . PHP_EOL;
- exit();
+if (!$autoloader || !class_exists('\Drupal')) {
+ if (PHP_SAPI !== 'cli') {
+ header('500 Internal Server Error');
+ }
+ print 'Failed to set up the autoloader. This can occur because composer install has not been run. Refer to https://www.drupal.org/docs/8/install/step-2-install-dependencies-with-composer for more information.' . PHP_EOL;
+ exit(1);
}
return $autoloader;
diff --git a/index.php b/index.php
index ae07f31842..750dc282dc 100644
--- a/index.php
+++ b/index.php
@@ -13,14 +13,6 @@
$autoloader = require_once 'autoload.php';
-if (!class_exists('\Drupal')) {
- header('500 Internal Server Error');
- print 'Dependencies error! The system cannot access some files in the vendor
folder.
' . PHP_EOL .
- 'Did you run composer install
? You may also need to check the folder permissions.
' . PHP_EOL .
- 'Refer to the the Drupal installation guide for instructions on installing with Composer.' . PHP_EOL;
- exit;
-}
-
$kernel = new DrupalKernel('prod', $autoloader);
$request = Request::createFromGlobals();