Skip to content

Instantly share code, notes, and snippets.

@wpottier
Last active October 11, 2016 07:52
Show Gist options
  • Select an option

  • Save wpottier/c4c552b56fee1d1b1d46 to your computer and use it in GitHub Desktop.

Select an option

Save wpottier/c4c552b56fee1d1b1d46 to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\HttpFoundation\Request;
umask(0000);
if (!isset($_SERVER['APPLICATION_ENV'])) {
$_SERVER['APPLICATION_ENV'] = 'prod';
}
/**
* @var Composer\Autoload\ClassLoader
*/
$loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
if ($_SERVER['APPLICATION_ENV'] == 'prod' && isset($_SERVER['AUTOLOAD_APC']) && $_SERVER['AUTOLOAD_APC']) {
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
$apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
}
$kernel = new AppKernel($_SERVER['APPLICATION_ENV'], $_SERVER['APPLICATION_ENV'] == 'dev');
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
@wpottier
Copy link
Author

Utilisation Apache :
SetEnv APPLICATION_ENV "dev"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment