index.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. // Path to the front controller (this file)
  3. define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
  4. // Ensure the current directory is pointing to the front controller's directory
  5. chdir(FCPATH);
  6. /*
  7. *---------------------------------------------------------------
  8. * BOOTSTRAP THE APPLICATION
  9. *---------------------------------------------------------------
  10. * This process sets up the path constants, loads and registers
  11. * our autoloader, along with Composer's, loads our constants
  12. * and fires up an environment-specific bootstrapping.
  13. */
  14. // const CI_ENVIRONMENT = "development";
  15. // const CI_DEBUG = true;
  16. // Load our paths config file
  17. // This is the line that might need to be changed, depending on your folder structure.
  18. require FCPATH . '../app/Config/Paths.php';
  19. // ^^^ Change this line if you move your application folder
  20. $paths = new Config\Paths();
  21. // Location of the framework bootstrap file.
  22. require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
  23. // Load environment settings from .env files into $_SERVER and $_ENV
  24. require_once SYSTEMPATH . 'Config/DotEnv.php';
  25. (new CodeIgniter\Config\DotEnv(ROOTPATH))->load();
  26. // Define ENVIRONMENT
  27. if (! defined('ENVIRONMENT')) {
  28. define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production'));
  29. }
  30. // Load Config Cache
  31. // $factoriesCache = new \CodeIgniter\Cache\FactoriesCache();
  32. // $factoriesCache->load('config');
  33. // ^^^ Uncomment these lines if you want to use Config Caching.
  34. /*
  35. * ---------------------------------------------------------------
  36. * GRAB OUR CODEIGNITER INSTANCE
  37. * ---------------------------------------------------------------
  38. *
  39. * The CodeIgniter class contains the core functionality to make
  40. * the application run, and does all the dirty work to get
  41. * the pieces all working together.
  42. */
  43. $app = Config\Services::codeigniter();
  44. $app->initialize();
  45. //$context = is_cli() ? 'php-cli' : 'web';
  46. $app->setContext('web');
  47. /*
  48. *---------------------------------------------------------------
  49. * LAUNCH THE APPLICATION
  50. *---------------------------------------------------------------
  51. * Now that everything is set up, it's time to actually fire
  52. * up the engines and make this app do its thang.
  53. */
  54. $app->run();
  55. // Save Config Cache
  56. // $factoriesCache->save('config');
  57. // ^^^ Uncomment this line if you want to use Config Caching.
  58. // Exits the application, setting the exit code for CLI-based applications
  59. // that might be watching.
  60. exit(EXIT_SUCCESS);