Skip to content

Instantly share code, notes, and snippets.

@wpottier
Last active August 29, 2015 13:57
Show Gist options
  • Save wpottier/9467972 to your computer and use it in GitHub Desktop.
Save wpottier/9467972 to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__ . '/../app/bootstrap.php.cache';
if(!isset($_SERVER['APPLICATION_ENV'])) {
$_SERVER['APPLICATION_ENV'] = (in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))) ? 'dev' : 'prod';
}
if ($_SERVER['APPLICATION_ENV'] == 'dev') {
Symfony\Component\Debug\Debug::enable();
}
// 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.
if ($_SERVER['APPLICATION_ENV'] == 'prod' && isset($_SERVER['APPLICATION_APC_PREFIX'])) {
$loader = new ApcClassLoader($_SERVER['APPLICATION_APC_PREFIX'], $loader);
$loader->register(true);
}
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel($_SERVER['APPLICATION_ENV'], $_SERVER['APPLICATION_ENV'] == 'dev');
$kernel->loadClassCache();
//if($_SERVER['APPLICATION_ENV'] == 'prod') {
// require_once __DIR__.'/../app/AppCache.php';
// $kernel = new AppCache($kernel);
//}
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment