install.php 1.56 KB
Newer Older
1 2
<?php

3 4 5 6 7
/**
 * @file
 * Initiates a browser-based installation of Drupal.
 */

8 9
use Drupal\Component\Utility\OpCodeCache;

10 11
// Change the directory to the Drupal root.
chdir('..');
12 13
// Store the Drupal root path.
$root_path = realpath('');
14

15
/**
16
 * Global flag to indicate the site is in installation mode.
17
 *
18 19 20
 * The constant is defined using define() instead of const so that PHP
 * versions prior to 5.3 can display proper PHP requirements instead of causing
 * a fatal error.
21
 */
22
define('MAINTENANCE_MODE', 'install');
23

24
// Exit early if running an incompatible PHP version to avoid fatal errors.
25 26 27
// The minimum version is specified explicitly, as DRUPAL_MINIMUM_PHP is not
// yet available. It is defined in bootstrap.inc, but it is not possible to
// load that file yet as it would cause a fatal error on older versions of PHP.
28 29
if (version_compare(PHP_VERSION, '7.0.8') < 0) {
  print 'Your PHP installation is too old. Drupal requires at least PHP 7.0.8. See the <a href="https://www.drupal.org/requirements">system requirements</a> page for more information.';
30 31 32
  exit;
}

33 34 35 36 37
// Initialize the autoloader.
$class_loader = require_once $root_path . '/autoload.php';

// If OPCache is in use, ensure opcache.save_comments is enabled.
if (OpCodeCache::isEnabled() && !ini_get('opcache.save_comments')) {
38
  print 'Systems with OPcache installed must have <a href="http://php.net/manual/opcache.configuration.php#ini.opcache.save-comments">opcache.save_comments</a> enabled.';
39 40 41
  exit();
}

42
// Start the installer.
43
require_once $root_path . '/core/includes/install.core.inc';
44
install_drupal($class_loader);