0

我已经从 Symfony 2.8 版升级到 3.4 版,一切都在本地运行良好,但这可能是因为它使用的是 app_dev.php 但是在生产中我得到了

PHP Fatal error: Uncaught Error: Class 'Symfony\\Component\\ClassLoader\\ApcClassLoader' not found in web/app.php 

但是,此文件位于供应商文件夹中。可能是我的 app.php 配置来自 2.8,如下所示,我将如何使用 apcu 缓存更改这项工作,我知道它已被弃用,但目前我的缓存很大程度上依赖于此。

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('123456etc', $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);
4

0 回答 0