1

几天后我将部署一个 Symfony2 应用程序,所以我想问一些关于app.php文件和设置正确生产环境的事情。所以这里是默认的app.php文件内容:

<?php

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';

// 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 ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
*/

require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';

$kernel = new AppKernel('prod', false);
$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);

以下是我的疑问:

  • 我应该启用 APC 加载程序吗?这将提高我的应用程序速度,或者这会做什么?
  • 如果我启用 APC 缓存加载器,这将是清理 APC 缓存的正确命令?
  • 我应该要求AppCache.php并删除AppKernel.php吗?
  • 我正在使用 PHP 5.6 并启用了 Zend OPCache,我是否应该安装并启用 APC Cache 并使用它来代替默认的 Zend OPCache?

如果您有任何 prod 就绪app.php文件,您可以分享它以及您的想法和建议吗?

4

0 回答 0