public/index.php line 34

Open in your IDE?
  1. <?php
  2. use App\Kernel;
  3. use Symfony\Component\Dotenv\Dotenv;
  4. use Symfony\Component\ErrorHandler\Debug;
  5. use Symfony\Component\HttpFoundation\Request;
  6. require dirname(__DIR__).'/vendor/autoload.php';
  7. \Pimcore\Bootstrap::setProjectRoot();
  8. // .env* files are intentionally not committed for this project — in
  9. // Docker/Coolify all config comes from real container env vars, so
  10. // only fall back to Dotenv when a local .env actually exists.
  11. $envDir = dirname(__DIR__);
  12. $appEnv = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'prod';
  13. if (is_file($envDir.'/.env') || is_file($envDir.'/.env.local.php') || is_file($envDir.'/.env.local') || is_file($envDir.'/.env.'.$appEnv)) {
  14.     (new Dotenv())->bootEnv($envDir.'/.env');
  15. }
  16. $_SERVER += $_ENV;
  17. $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'prod';
  18. $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $_SERVER['APP_ENV']);
  19. $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
  20. if ($_SERVER['APP_DEBUG']) {
  21.     umask(0000);
  22.     Debug::enable();
  23. }
  24. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  25. \Pimcore::setKernel($kernel);
  26. $request = Request::createFromGlobals();
  27. $response = $kernel->handle($request);
  28. $response->send();
  29. $kernel->terminate($request, $response);