Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created October 10, 2014 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwardIII/668a5981ef4852a6eceb to your computer and use it in GitHub Desktop.
Save EdwardIII/668a5981ef4852a6eceb to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$apcLoader = new ApcClassLoader('sf2', $loader);
$loader->unregister();
$apcLoader->register(true);
*/
// Allow switching between env and debug using env vars
// In apache, switch by setting this in the site's
// vhost:
// SetEnv SYMFONY_ENV dev
// SetEnv SYMFONY_DEBUG 1
// Can be dev, test or prod
$env = getenv('SYMFONY_ENV') ?: 'prod';
$debug = getenv('SYMFONY_DEBUG') === '1';
if ($debug) {
Debug::enable();
}
require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
try {
$kernel = new AppKernel($env, $debug);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
session_write_close();
}catch(Exception $e){
trigger_error($e->getTraceAsString);
throw $e;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment