install.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * @file
  4. * Initiates a browser-based installation of Drupal.
  5. */
  6. use Drupal\Component\Utility\OpCodeCache;
  7. // Change the directory to the Drupal root.
  8. chdir('..');
  9. // Store the Drupal root path.
  10. $root_path = realpath('');
  11. /**
  12. * Global flag to indicate the site is in installation mode.
  13. *
  14. * The constant is defined using define() instead of const so that PHP
  15. * versions prior to 5.3 can display proper PHP requirements instead of causing
  16. * a fatal error.
  17. */
  18. define('MAINTENANCE_MODE', 'install');
  19. // Exit early if running an incompatible PHP version to avoid fatal errors.
  20. // The minimum version is specified explicitly, as DRUPAL_MINIMUM_PHP is not
  21. // yet available. It is defined in bootstrap.inc, but it is not possible to
  22. // load that file yet as it would cause a fatal error on older versions of PHP.
  23. if (version_compare(PHP_VERSION, '7.0.8') < 0) {
  24. 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.';
  25. exit;
  26. }
  27. // Initialize the autoloader.
  28. $class_loader = require_once $root_path . '/autoload.php';
  29. // If OPCache is in use, ensure opcache.save_comments is enabled.
  30. if (OpCodeCache::isEnabled() && !ini_get('opcache.save_comments')) {
  31. 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.';
  32. exit();
  33. }
  34. // Start the installer.
  35. require_once $root_path . '/core/includes/install.core.inc';
  36. install_drupal($class_loader);