bootstrap.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Environment initialization
  8. */
  9. error_reporting(E_ALL);
  10. stream_wrapper_unregister('phar');
  11. #ini_set('display_errors', 1);
  12. /* PHP version validation */
  13. if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 70103) {
  14. if (PHP_SAPI == 'cli') {
  15. echo 'Magento supports PHP 7.1.3 or later. ' .
  16. 'Please read https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html';
  17. } else {
  18. echo <<<HTML
  19. <div style="font:12px/1.35em arial, helvetica, sans-serif;">
  20. <p>Magento supports PHP 7.1.3 or later. Please read
  21. <a target="_blank" href="https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html">
  22. Magento System Requirements</a>.
  23. </div>
  24. HTML;
  25. }
  26. exit(1);
  27. }
  28. require_once __DIR__ . '/autoload.php';
  29. // Sets default autoload mappings, may be overridden in Bootstrap::create
  30. \Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
  31. /* Custom umask value may be provided in optional mage_umask file in root */
  32. $umaskFile = BP . '/magento_umask';
  33. $mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
  34. umask($mask);
  35. if (empty($_SERVER['ENABLE_IIS_REWRITES']) || ($_SERVER['ENABLE_IIS_REWRITES'] != 1)) {
  36. /*
  37. * Unset headers used by IIS URL rewrites.
  38. */
  39. unset($_SERVER['HTTP_X_REWRITE_URL']);
  40. unset($_SERVER['HTTP_X_ORIGINAL_URL']);
  41. unset($_SERVER['IIS_WasUrlRewritten']);
  42. unset($_SERVER['UNENCODED_URL']);
  43. unset($_SERVER['ORIG_PATH_INFO']);
  44. }
  45. if (
  46. (!empty($_SERVER['MAGE_PROFILER']) || file_exists(BP . '/var/profiler.flag'))
  47. && isset($_SERVER['HTTP_ACCEPT'])
  48. && strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
  49. ) {
  50. $profilerConfig = isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER'])
  51. ? $_SERVER['MAGE_PROFILER']
  52. : trim(file_get_contents(BP . '/var/profiler.flag'));
  53. if ($profilerConfig) {
  54. $profilerConfig = json_decode($profilerConfig, true) ?: $profilerConfig;
  55. }
  56. Magento\Framework\Profiler::applyConfig(
  57. $profilerConfig,
  58. BP,
  59. !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
  60. );
  61. }
  62. date_default_timezone_set('UTC');
  63. /* For data consistency between displaying (printing) and serialization a float number */
  64. ini_set('precision', 14);
  65. ini_set('serialize_precision', 14);