【发布时间】:2014-10-11 14:12:21
【问题描述】:
我正在尝试将我的环境从 dev 更改为 prod。 当我尝试使用 prod env 进行无效路由时,我得到了 dev 错误页面“NotFoundHttpException:”,而不是像“e-mail us...”这样的 prod 错误页面。
有我的 app.php :
use Symfony\Component\ClassLoader\ApcClassLoader;
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);*/
require_once __DIR__.'/../app/AppKernel.php';
require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel('prod', true);
$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);
有什么想法吗?
谢谢, 阿德里安
【问题讨论】:
-
尝试:AppKernel('prod', false);并清除缓存。不确定它是否会有所帮助。
标签: symfony http-status-code-404 production-environment