had the same problem, this is how i did it:
In line 12 replace
$loader = new ApcClassLoader('sf2', $loader);
with
$loader = new XcacheClassLoader('sf2', $loader);
(and define correct use statement)
Question
Because a Bug in APC, i had to use another Cache-Drive. I removed APC and installed xcache. config.php says Your configuration looks good to run Symfony.
I got the following error on request:
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to use ApcClassLoader as APC is not enabled.' in /var/.../app/bootstrap.php.cache:1039
Stack trace:
#0 /var/.../web/app.php(11): Symfony\\Component\\ClassLoader\\ApcClassLoader->__construct('sf2', Object(Composer\\Autoload\\ClassLoader))
#1 {main}
thrown in /var/...app/bootstrap.php.cache on line 1039
How do I tell Symfony to use xcache instead of APC?
Solution
had the same problem, this is how i did it:
In line 12 replace
$loader = new ApcClassLoader('sf2', $loader);
with
$loader = new XcacheClassLoader('sf2', $loader);
(and define correct use statement)
OTHER TIPS
after replace $loader = new ApcClassLoader('tcs_beta_prod', $loader);
to
$loader = new XcacheClassLoader('tcs_beta_prod', $loader);
and add use Symfony\Component\ClassLoader\XcacheClassLoader;
i have this bug Fatal error: Class 'Symfony\Component\ClassLoader\XcacheClassLoader' not found in C:\xampp\htdocs\edt\web\app.php on line 11
.
Here is my app.php
<?php
use Symfony\Component\ClassLoader\XcacheClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
// Use APC for autoloading to improve performance
// Change 'sf2' by the prefix you want in order to prevent key conflict with another application
$loader = new XcacheClassLoader('tcs_beta_prod', $loader);
$loader->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);
$request = Request::createFromGlobals();
Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR'))); // per suggestion from Farid / Patrick to deal with ELB proxying
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
You didn't define the use statement for XCache:
use Symfony\Component\ClassLoader\XcacheClassLoader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\ClassLoader\XcacheClassLoader;