Symfony apcu class loader not found, upgrade from 2.8 to 3.4

I’ve upgraded from Symfony version 2.8 to 3.4 everything worked fine locally, but this may be because it was using app_dev.php however in production I get

PHP Fatal error: Uncaught Error: Class 'SymfonyComponentClassLoaderApcClassLoader' not found in web/app.php 

However this file is there in the vendor folder. It could be that my configuration of app.php is from 2.8 as below, how would I change this work with apcu cache, which I’m aware is deprecated, but currently my caching relies a lot on this.

use SymfonyComponentClassLoaderApcClassLoader;
use SymfonyComponentHttpFoundationRequest;

$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);

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *